14 March 2016 Last updated at 07:19 GMT
Well that's exactly what happens with turtles.
But experts in Australia are now worried that rising temperatures over time could cause chaos for turtle populations by creating too many female turtles.
Martin's got more on this story.
Footage courtesy of ABC 'Behind the News' (Australia)
Can you imagine if the temperature decided whether you were born a girl or a boy?