Various terms are used to talk about sex and gender:
Sex refers to a person's anatomy: male, female, or not clearly male or female (ambiguous genitals, or intersex).
Sexual identity refers to the sex to which a person is sexually attracted.
Gender identity is how people see themselves, whether masculine, feminine, or something else (sometimes called genderqueer), which may be somewhere in-between, a combination of masculine and feminine, or neither or which may frequently change.
Gender role is how people present themselves in public in terms of gender. It includes the way people dress, speak, wear their hair—in fact everything that people say and do that indicates masculinity or femininity.
For most people, gender identity is consistent with their anatomic (birth) sex and their gender role (as when a man has an inner sense of masculinity and publicly acts in masculine ways).
Gender identity is well established by early childhood (18 to 24 months of age). During childhood, boys come to know they are boys, and girls come to know they are girls. Children sometimes prefer activities considered to be more appropriate for the other sex (called gender-nonconforming behavior). However, this preference does not mean that a young girl who, for example, likes to play baseball and wrestle has a gender identity problem, as long as she sees herself as and is content with being female. Similarly, a boy who plays with dolls and prefers cooking to sports or to rough types of play does not have a gender identity problem as long as he identifies himself as and is comfortable with being male. Young boys often pass through phases where they play with girls' toys or clothes, but few of them have problems with gender identity as adults. Most boys who prefer activities considered more appropriate for girls do not have a gender identity problem when they grow up, but many are homosexual or bisexual in their sexual orientation.
Children born with ambiguous genitals usually do not have a gender identity problem if they are decisively reared as one sex or the other, even if they are raised in the gender role that is opposite to their biologic sex pattern. There have been some highly publicized cases, however, in which this approach failed.
Sometimes people feel that their gender identity and their anatomic sex do not match. Sometimes this feeling causes significant distress or impairs their ability to function. This condition is called gender dysphoria. People with gender dysphoria may need to be evaluated by a health care practitioner.