In 2003, Harvard University student Mark Zuckerberg gets the idea to create a website to rate the attractiveness of female Harvard undergraduates after his girlfriend Erica Albright breaks up with him. Mark hacks into the databases of various residence halls and downloads pictures and names. Using an algorithm supplied by his best friend Eduardo Saverin, Mark creates a page called "FaceMash", where male students choose which of two girls is more attractive.
Mark is punished with six months of academic probation after the traffic to the site crashes parts of Harvard's network, and becomes vilified among most of Harvard's female community. However, the popularity of "FaceMash" and the fact that he created it in one night, while drunk, brings him to the attention of Cameron Winklevoss and Tyler Winklevoss, identical twins and members of Harvard's rowing team, and their business partner Divya Narendra. As a result, he gains a job working for the Winklevoss twins as the programmer of the website, Harvard Connection.
Soon afterwards, Mark approaches his friend Eduardo, who has recently been invited to pledge the Phoenix S-K final club. Mark has an idea for what he calls "Thefacebook", an online social networking tool exclusive to Harvard University students, where people can display personal information. He explains this lets people share certain information without the invasion of privacy. Eduardo agrees to help Mark, providing a thousand dollars to help start the site. Mark and Eduardo eventually launch Facebook, distributing the link to Eduardo's connections at the Phoenix S-K. The site quickly becomes popular throughout the student body. When Divya learns about the launch of Thefacebook, he tells the Winklevoss twins that Mark stole their idea; Cameron and Divya want to sue Mark for intellectual property theft, but Tyler votes against it.
At a lecture by Bill Gates, fellow Harvard University student Christy Lee introduces herself and her best friend Alice to Eduardo and Mark. She asks that the boys "Facebook us", which impresses both of them. She also invites the boys to drinks at a bar, at the bar Christy and Eduardo have sex in the bar's public open toilet, Mark also has sex with Christy's friend at the bar. During drinks with Christy and Alice, Mark runs into his ex-girlfriend, who is not aware of The Facebook's existence. Mark decides to expand the site to more schools. Christy, Mark, and Eduardo later return to Mark's room where they outline the structure of the company and their plan for moving forward.
As The Facebook grows in popularity, they expand to other schools in the Northeastern United States, initially Yale and Columbia, and Stanford as well, while the Winklevoss twins and Narendra become angrier at seeing "their idea" advance without them. Tyler refuses to sue them, instead accusing Mark of violating the Harvard student Code of Conduct. Through their father's connections they arrange a meeting with Harvard President Larry Summers, who is dismissive and sees no potential value in either a disciplinary action or in Thefacebook website itself.
Through Christy Lee, now Eduardo's girlfriend, Eduardo and Mark arrange a meeting with Napster co-founder Sean Parker. When Christy, Mark and Eduardo meet Parker, Eduardo becomes skeptical of Parker, noting his problematic personal and professional history. Mark, however, is impressed with Parker since he presented a similar vision of Facebook. Although no deals are reached, Parker suggests that they drop "The" from Thefacebook to make it simply "Facebook".
While Eduardo remains in New York for advertising support, Mark and Dustin Moskovitz move the company's base of operation to Palo Alto. When Eduardo visits from New York, he is angered that Sean Parker is living at the house and making business decisions for Facebook. After an argument with Mark, Eduardo freezes the bank account which he had set up for the company and returns to New York. Upon returning to New York, Christy and Eduardo get into an argument regarding his Facebook profile, which still lists him as "single". Christy accuses Eduardo of cheating on her citing his profile as evidence. Due to her anger and frustration, Christy tries to set fire to Eduardo's room by burning a scarf he gave her as a gift, however does not want to end her relationship with Eduardo. As a result of Christy's pyromaniac tendency, Eduardo ends his romantic relationship with Christy. While Eduardo extinguishes the fire Christy creates, Mark reveals they have secured money from an angel investor.
In England, the Winklevoss twins become outraged that Facebook has expanded to universities in the United Kingdom and decide to sue Facebook. Meanwhile Eduardo learns that Mark and Sean have reduced his share of the company from a third to less than one tenth of one percent and decides to sue as well. At a party to celebrate the one millionth member of Facebook, Sean and several Facebook interns are arrested for possession of cocaine.
The framing device throughout the film shows Mark testifying in depositions in two lawsuits: one filed by the Winklevoss twins, and the other filed by Eduardo. In the final scene, a junior lawyer for the defense informs Mark they will be settling with Eduardo, since the sordid details of Facebook's founding and Mark's personality will make a jury highly unsympathetic. The film ends with Mark sending a friend request to his former girlfriend Erica on Facebook, and then refreshing the page every few seconds waiting for a response.