Social network sites, such as Facebook, have acquired an unprecedented following, yet it is unknown what makes them so attractive to users. Here we propose that these sites' popularity can be understood through the fulfillment of ego needs. We use self-affirmation theory to hypothesize why and when people spend time on their online profiles. Study 1 shows that Facebook profiles are self-affirming in the sense of satisfying users' need for self-worth and self-integrity. Study 2 shows that Facebook users gravitate toward their online profiles after receiving a blow to the ego, in an unconscious effort to repair their perceptions of self-worth. In addition to illuminating some of the psychological factors that underlie Facebook use, the results provide an important extension to self-affirmation theory by clarifying how self-affirmation operates in people's everyday environments.