Gender was traditionally used mainly in grammar- and language-related contexts to refer to the sex assigned to nouns (especially in non-English languages). For example, the gender of the French noun maison (house) is feminine, while the gender of livre (book) is masculine. Sex was used in many of the contexts in which we now use gender.
In recent years, the meaning of sex has narrowed and is mainly confined to uses having to do with sexual intercourse or sexual organs. Gender, meanwhile, is increasingly used to refer to a person’s sexual identity. So, for instance, we might say that a boy’s gender is male and a girl’s gender is female.
Sex may still be used in its traditional sense—i.e., the property by which organisms are classified as male or female based on reproductive organs—but gender is sometimes safer in contexts where sex once would have been appropriate. For example, some readers may be uncomfortable with the phrase the baby’s sex, while no one would have a problem with the baby’s gender.
Examples
In these examples, the writers use gender where sex may once have been used:
Disparities: A Growing Gender Gap in Doctors’ Pay [NY Times headline]
Apparently, the two aren’t letting their babies’ gender be a surprise … [ABC News]
The European Court could outlaw the use of gender in determining insurance pricing on 1 March when it rules on the matter … [Money Saving Expert]

