The id includes primitive and instinctive behaviors, whereas the ego is the part of personality concerned with reality. Id and ego are two of the three elements of personality proposed by Sigmund Freud.
According to Freud, the id is the only part of personality in existence from birth. It is largely guided by the pleasure principle. The ego manages the impulsiveness of the id in order to achieve socially acceptable actions. The ego functions according to the reality principle.
Freud's third component of personality is the superego. The superego is the last aspect of personality to surface, developing around 5 years of age. The superego is the part of personality largely responsible for a person's sense of right and wrong.