Sex refers to physical attributes (notably sex organs) that are distinct for a majority of individuals around the world. However, gender is about femininity or masculinity (the composite of behavior and attitudes of women and men).
Secondly, sex is biologically predetermined—usually by hormones and genes during birth development. Gender, on the other hand, is perpetuated and learned through religion, education, and family. Gender is, therefore, an acquired identity rather than a biological identity.
While an individual can only turn to surgery to change their sex, gender is more fluid. A person can alter their gender depending on how they choose to identify. Gender is much more than just an individual's reproductive organs and encompasses a person's experience and perception of themselves and their roles in society.
Finally, gender is a socialized attribute, which means it can vary across cultures and through time. Sex, however, usually remains constant across cultures and through time.