Two-thirds of Facebook members log on at least once a day; the typical user spends twenty minutes on the site. Illustration by Adrian Tomine

In August, 1995, when Netscape issued stock on the Nasdaq and became the first major Internet company to go public, Mark Zuckerberg was about to enter the sixth grade at a middle school in Ardsley, a small town in Westchester County. He had a new desktop computer—a Quantex 486DX with an Intel 486 processing chip—and had bought a book called “C++ for Dummies,” to teach himself how to write software. “I just liked making things,” he recalled recently. “Then I figured out I could make more things if I learned to program.” By the time he finished ninth grade, at Ardsley High, he had designed a computer version of the board game Risk, in which rival forces battle for global domination. Zuckerberg’s game was set in the Roman Empire, which he was studying in Latin class, and featured a virtual general called Julius Caesar, who was such an able military strategist that even Zuckerberg had trouble defeating him.

Two years later, his parents, a dentist and a psychiatrist, sent him to Phillips Exeter Academy, in New Hampshire, where, during the spring of his senior year, he and a roommate, Adam D’Angelo, wrote some software for WinAmp, an MP3 player, which chose songs from a user’s digital library based on his previous selections. If a user had been playing Garbage, or the Clash, the program that Zuckerberg and D’Angelo created might pick a song by Green Day. They called their program Synapse and posted it on the Web, where it proved popular, especially after the technology site Slashdot.org linked to it. Several software companies, including Microsoft, approached Zuckerberg about acquiring it, but none made a formal offer. “What they really wanted was for us to come and work for them,” Zuckerberg told me. “We didn’t want to do that.”

In the fall of 2002, Zuckerberg enrolled at Harvard, where he decided to major in psychology. “I just think people are the most interesting thing—other people,” he said. “What it comes down to, for me, is that people want to do what will make them happy, but in order to understand that they really have to understand their world and what is going on around them.” Between classes, he continued to write programs, including one called Coursematch, which enabled students to find out who was enrolled in a particular class. Early in his sophomore year, he built a Web site called Facemash, a Harvard version of HOTorNOT.com, a site where people post sexy photographs of themselves that others rate on a scale of one to ten. Most Harvard residential houses, including Kirkland House, where Zuckerberg lived, had Web sites displaying photographs from student I.D.s. Zuckerberg downloaded some of the pictures—of men and women—and posted two at a time on a Web page, inviting other students to vote on which person was more attractive. The votes were then converted into a cuteness top-ten list for each house.

Within a few hours after he posted the first photographs, about four hundred and fifty people had visited the site, and more than twenty-two thousand votes had been recorded. Then, without warning, the university blocked Zuckerberg’s Internet access; some students and professors had complained to Harvard authorities that the site was offensive. Harvard’s Administrative Board summoned Zuckerberg to a hearing, accusing him of violating students’ privacy and of stealing the university’s intellectual property by downloading pictures without permission. The board could have suspended Zuckerberg, or even expelled him. Instead, after he agreed to take down the Web site, he escaped with a warning. That night, he and his roommates celebrated with a bottle of champagne.

Zuckerberg was acquiring a reputation on campus as a programming prodigy. Soon after Facemash was shut down, he was invited to help write code for an ambitious Web site conceived by three Harvard seniors: Tyler and Cameron Winklevoss, twin brothers; and Divya Narendra. Since late 2002, the Winklevosses and Narendra had been talking about creating a Web site for Harvard students modelled on “social networking” sites like Friendster and Tribe.net, which were just beginning to catch on. The sites, which invited members to post a photograph and a few personal details—a profile—and link to other members, exploited the peculiar logic of networks, by which large numbers of people are connected through a small number of intermediaries and become part of a vast virtual community. By the fall of 2003, the Winklevosses and Narendra, with the help of a couple of student programmers, had designed a prototype, which they called HarvardConnection. At Narendra’s suggestion, the Winklevosses approached Zuckerberg about helping them finish the site, which they hoped to launch before they graduated, the following June. “We met Mark, and we talked to him, and we thought this guy seems like a winner,” Tyler Winklevoss said to me recently.

Zuckerberg began working on HarvardConnection in November, 2003. At the same time, he pursued his own projects. Like many other colleges, Harvard offers every freshman a copy of the class directory, known as the “facebook,” which features a photograph of each member, accompanied by a few identifying facts, such as name, date of birth, home town, and high school. For some time, Harvard had been planning to put the facebook online; Zuckerberg decided to do the job himself. “I just thought that being able to have access to different people’s profiles would be interesting,” he recalled. “Obviously, there’s no way you can get access to that stuff unless people are throwing up profiles, so I wanted to make an application that would allow people to do that, to share as much information as they wanted while having control over what they put up.”

Zuckerberg discussed the idea with two of his roommates, Chris Hughes and Dustin Moskovitz, who agreed that it was a good one. In late January, 2004, during a weeklong break between semesters, he remained in his dorm room, working through the night on his site. “The challenge was to make it work,” he said. “I don’t like to design things to look showy or cool. It wasn’t like I was looking at it and saying, ‘This is sweet.’ He paused, then added, “I don’t use the word ‘sweet’ anymore.” In ten days, he had completed most of the site, which he was determined to keep simple. Anybody with a Harvard e-mail address could join and create a profile, which consisted of a photograph and some personal information, such as the user’s major; club memberships; taste in films, books, and music; and favorite quotes. There was a search box to help users call up other profiles, and a “poking” button, which they could use to let other people know that their profiles had been viewed. Users could also link to their friends’ profiles—a feature popularized by Friendster. To test the site, Zuckerberg created three sample profiles, which looked pretty good. Then he created profiles for himself and for Hughes and Moskovitz.

Thefacebook.com went up on Wednesday, February 4, 2004. “It was a normal night in the dorm,” Moskovitz recalled. “When Mark finished the site, we told a couple of friends. And then one of them suggested putting it on the Kirkland House online mailing list, which was, like, three hundred people. And, once they did that, several dozen people joined, and then they were telling people at the other houses. By the end of the night, we were, like, actively watching the registration process. Within twenty-four hours, we had somewhere between twelve hundred and fifteen hundred registrants.”