In English, the two terms gender and sex are sometimes used interchangeably, but sex often refers specifically to biological differences, while gender more often refers to cultural and social differences. Gender therefore refers to socially constructed norms, assignments and roles which can be different from one society to another and which do not necessarily correspond to the biological sex of the person.
Gender is a spectrum
There are many different gender identities which people can feel they belong to. The term trans (or transgender) is used to refer to people who identify with a different gender than the sex assigned to them at birth. The term cis (or cisgender) applies to people whose gender identity does correspond with their birth sex. Where the biological sex (as indicated by physical sexual characteristics) is not unambiguously male or female, people can be referred to as intersexual. A person who does not identify as male or female, regardless of their genitals, might call themselves non-binary.
In fact, even biological sex is not binary, since it is determined by a spectrum of features. The labels ‘male’ and ‘female’ merely describe the ends of this spectrum, with a whole range of possibilities between them.