Mark Zuckerberg founded Facebook in his college dorm room six years ago. Five hundred million people have joined since, and eight hundred and seventy-nine of them are his friends. The site is a directory of the world’s people, and a place for private citizens to create public identities. You sign up and start posting information about yourself: photographs, employment history, why you are peeved right now with the gummy-bear selection at Rite Aid or bullish about prospects for peace in the Middle East. Some of the information can be seen only by your friends; some is available to friends of friends; some is available to anyone. Facebook’s privacy policies are confusing to many people, and the company has changed them frequently, almost always allowing more information to be exposed in more ways.

The C.E.O. of Facebook wants to create, and dominate, a new kind of Internet. Photograph by Carlos Serrao

According to his Facebook profile, Zuckerberg has three sisters (Randi, Donna, and Arielle), all of whom he’s friends with. He’s friends with his parents, Karen and Edward Zuckerberg. He graduated from Phillips Exeter Academy and attended Harvard University. He’s a fan of the comedian Andy Samberg and counts among his favorite musicians Green Day, Jay-Z, Taylor Swift, and Shakira. He is twenty-six years old.

Zuckerberg cites “Minimalism,” “Revolutions,” and “Eliminating Desire” as interests. He likes “Ender’s Game,” a coming-of-age science-fiction saga by Orson Scott Card, which tells the story of Andrew (Ender) Wiggin, a gifted child who masters computer war games and later realizes that he’s involved in a real war. He lists no other books on his profile.

Zuckerberg’s Facebook friends have access to his e-mail address and his cell-phone number. They can browse his photograph albums, like one titled “The Great Goat Roast of 2009,” a record of an event held in his back yard. They know that, in early July, upon returning from the annual Allen & Company retreat for Hollywood moguls, Wall Street tycoons, and tech titans, he became Facebook friends with Barry Diller. Soon afterward, Zuckerberg wrote on his Facebook page, “Is there a site that streams the World Cup final online? (I don’t own a TV.)”

Since late August, it’s also been pretty easy to track Zuckerberg through a new Facebook feature called Places, which allows users to mark their location at any time. At 2:45 A.M., E.S.T., on August 29th, he was at the Ace Hotel, in New York’s garment district. He was back at Facebook’s headquarters, in Palo Alto, by 7:08 P.M. On August 31st at 10:38 P.M., he and his girlfriend were eating dinner at Taqueria La Bamba, in Mountain View.

Zuckerberg may seem like an over-sharer in the age of over-sharing. But that’s kind of the point. Zuckerberg’s business model depends on our shifting notions of privacy, revelation, and sheer self-display. The more that people are willing to put online, the more money his site can make from advertisers. Happily for him, and the prospects of his eventual fortune, his business interests align perfectly with his personal philosophy. In the bio section of his page, Zuckerberg writes simply, “I’m trying to make the world a more open place.”

The world, it seems, is responding. The site is now the biggest social network in countries ranging from Indonesia to Colombia. Today, at least one out of every fourteen people in the world has a Facebook account. Zuckerberg, meanwhile, is becoming the boy king of Silicon Valley. If and when Facebook decides to go public, Zuckerberg will become one of the richest men on the planet, and one of the youngest billionaires. In the October issue of Vanity Fair, Zuckerberg is named No. 1 in the magazine’s power ranking of the New Establishment, just ahead of Steve Jobs, the leadership of Google, and Rupert Murdoch. The magazine declared him “our new Caesar.”

Despite his goal of global openness, however, Zuckerberg remains a wary and private person. He doesn’t like to speak to the press, and he does so rarely. He also doesn’t seem to enjoy the public appearances that are increasingly requested of him. Backstage at an event at the Computer History Museum, in Silicon Valley, this summer, one of his interlocutors turned to Zuckerberg, minutes before they were to appear onstage, and said, “You don’t like doing these kinds of events very much, do you?” Zuckerberg replied with a terse “No,” then took a sip from his water bottle and looked off into the distance.

This makes the current moment a particularly awkward one. Zuckerberg, or at least Hollywood’s unauthorized version of him, will soon be starring in a film titled “The Social Network,” directed by David Fincher and written by Aaron Sorkin. The movie, which opens the New York Film Festival and will be released on October 1st, will be the introduction that much of the world gets to Zuckerberg. Facebook profiles are always something of a performance: you choose the details you want to share and you choose whom you want to share with. Now Zuckerberg, who met with me for several in-person interviews this summer, is confronting something of the opposite: a public exposition of details that he didn’t choose. He does not plan to see the film.

Zuckerberg––or Zuck, as he is known to nearly everyone of his acquaintance––is pale and of medium build, with short, curly brown hair and blue eyes. He’s only around five feet eight, but he seems taller, because he stands with his chest out and his back straight, as if held up by a string. His standard attire is a gray T-shirt, bluejeans, and sneakers. His affect can be distant and disorienting, a strange mixture of shy and cocky. When he’s not interested in what someone is talking about, he’ll just look away and say, “Yeah, yeah.” Sometimes he pauses so long before he answers it’s as if he were ignoring the question altogether. The typical complaint about Zuckerberg is that he’s “a robot.” One of his closest friends told me, “He’s been overprogrammed.” Indeed, he sometimes talks like an Instant Message—brusque, flat as a dial tone—and he can come off as flip and condescending, as if he always knew something that you didn’t. But face to face he is often charming, and he’s becoming more comfortable onstage. At the Computer History Museum, he was uncommonly energetic, thoughtful, and introspective—relaxed, even. He addressed concerns about Facebook’s privacy settings by relaying a personal anecdote of the sort that his answers generally lack. (“If I could choose to share my mobile-phone number only with everyone on Facebook, I wouldn’t do it. But because I can do it with only my friends I do it.”) He was self-deprecating, too. Asked if he’s the same person in front of a crowd as he is with friends, Zuckerberg responded, “Yeah, same awkward person.”

Zuckerberg grew up in a hilltop house in Dobbs Ferry, New York. Attached to the basement is the dental office of his father, Edward Zuckerberg, known to his patients as “painless Dr. Z.” (“We cater to cowards,” his Web site reads.) There’s a hundred-and-sixty-gallon fish tank in the operating room, and the place is packed with marine-oriented tchotchkes that Dr. Zuckerberg’s patients have brought him. Mark’s mother, Karen, is a psychiatrist who stopped practicing to take care of the children and to work as her husband’s office manager.

Edward was an early user of digital radiography, and he introduced Atari BASIC computer programming to his son. The house and the dental office were full of computers. One afternoon in 1996, Edward declared that he wanted a better way of announcing a patient’s arrival than the receptionist yelling, “Patient here!” Mark built a software program that allowed the computers in the house and the office to send messages to one another. He called it ZuckNet, and it was basically a primitive version of AOL Instant Messenger, which came out the following year. The receptionist used it to ping Edward, and the kids used it to ping each other. One evening while Donna was working in her room, downstairs, a screen popped up: the computer contained a deadly virus and would blow up in thirty seconds. As the machine counted down, Donna ran up the stairs shouting, “Mark!”

Some kids played computer games. Mark created them. In all of our talks, the most animated Zuckerberg ever got—speaking with a big smile, almost tripping on his words, his eyes alert—was when he described his youthful adventures in coding. “I had a bunch of friends who were artists,” he said. “They’d come over, draw stuff, and I’d build a game out of it.” When he was about eleven, his parents hired a computer tutor, a software developer named David Newman, who came to the house once a week to work with Mark. “He was a prodigy,” Newman told me. “Sometimes it was tough to stay ahead of him.” (Newman lost track of Zuckerberg and was stunned when he learned during our interview that his former pupil had built Facebook.) Soon thereafter, Mark started taking a graduate computer course every Thursday night at nearby Mercy College. When his father dropped him off at the first class, the instructor looked at Edward and said, pointing to Mark, “You can’t bring him to the classroom with you.” Edward told the instructor that his son was the student.

Mark was not a stereotypical geek-klutz. At Exeter, he became captain of the fencing team. He earned a diploma in classics. But computers were always central. For his senior project at Exeter, he wrote software that he called Synapse. Created with a friend, Synapse was like an early version of Pandora—a program that used artificial intelligence to learn users’ listening habits. News of the software’s existence spread on technology blogs. Soon AOL and Microsoft made it known that they wanted to buy Synapse and recruit the teen-ager who’d invented it. He turned them down.

Zuckerberg decided, instead, to enter Harvard, in the fall of 2002. He arrived in Cambridge with a reputation as a programming prodigy. He sometimes wore a T-shirt with a little ape on it and the words “Code Monkey.” He joined the Jewish fraternity Alpha Epsilon Pi, and, at a Friday-night party there, Zuckerberg, then a sophomore, met his current girlfriend, Priscilla Chan, a Chinese-American from the Boston suburbs. They struck up a conversation while waiting in line for the bathroom. “He was this nerdy guy who was just a little bit out there,” Chan told me. “I remember he had these beer glasses that said ‘pound include beer dot H.’ It’s a tag for C++. It’s like college humor but with a nerdy, computer-science appeal.”

Zuckerberg had a knack for creating simple, addictive software. In his first week as a sophomore, he built CourseMatch, a program that enabled users to figure out which classes to take based on the choices of other students. Soon afterward, he came up with Facemash, where users looked at photographs of two people and clicked a button to note who they thought was hotter, a kind of sexual-playoff system. It was quickly shut down by the school’s administration. Afterward, three upperclassmen—an applied-math major from Queens, Divya Narendra, and twins from Greenwich, Connecticut, Cameron and Tyler Winklevoss—approached Zuckerberg for assistance with a site that they had been working on, called Harvard Connection.

Zuckerberg helped Narendra and the Winklevoss twins, but he soon abandoned their project in order to build his own site, which he eventually labelled Facebook. The site was an immediate hit, and, at the end of his sophomore year, Zuckerberg dropped out of Harvard to run it.

As he tells the story, the ideas behind the two social networks were totally different. Their site, he says, emphasized dating, while his emphasized networking. The way the Winklevoss twins tell it, Zuckerberg stole their idea and deliberately kept them from launching their site. Tall, wide-shouldered, and gregarious, the twins were champion rowers who competed in the Beijing Olympics; they recently earned M.B.A.s from Oxford. “He stole the moment, he stole the idea, and he stole the execution,” Cameron told me recently. The dispute has been in court almost since Facebook was launched, six years ago. Facebook eventually reached a settlement, reportedly worth sixty-five million dollars, with the Winklevosses and Narendra, but they are now appealing for more, claiming that Facebook misled them about the value of the stock they would receive.

To prepare for litigation against the Winklevosses and Narendra, Facebook’s legal team searched Zuckerberg’s computer and came across Instant Messages he sent while he was at Harvard. Although the IMs did not offer any evidence to support the claim of theft, according to sources who have seen many of the messages, the IMs portray Zuckerberg as backstabbing, conniving, and insensitive. A small group of lawyers and Facebook executives reviewed the messages, in a two-hour meeting in January, 2006, at the offices of Jim Breyer, the managing partner at the venture-capital firm Accel Partners, Facebook’s largest outside investor.

The technology site Silicon Alley Insider got hold of some of the messages and, this past spring, posted the transcript of a conversation between Zuckerberg and a friend, outlining how he was planning to deal with Harvard Connect:

FRIEND: so have you decided what you are going to do about the websites? ZUCK: yea i’m going to fuck them ZUCK: probably in the year ZUCK: *ear

In another exchange leaked to Silicon Alley Insider, Zuckerberg explained to a friend that his control of Facebook gave him access to any information he wanted on any Harvard student:

ZUCK: yea so if you ever need info about anyone at harvard ZUCK: just ask ZUCK: i have over 4000 emails, pictures, addresses, sns FRIEND: what!? how’d you manage that one? ZUCK: people just submitted it ZUCK: i don’t know why ZUCK: they “trust me” ZUCK: dumb fucks

According to two knowledgeable sources, there are more unpublished IMs that are just as embarrassing and damaging to Zuckerberg. But, in an interview, Breyer told me, “Based on everything I saw in 2006, and after having a great deal of time with Mark, my confidence in him as C.E.O. of Facebook was in no way shaken.” Breyer, who sits on Facebook’s board, added, “He is a brilliant individual who, like all of us, has made mistakes.” When I asked Zuckerberg about the IMs that have already been published online, and that I have also obtained and confirmed, he said that he “absolutely” regretted them. “If you’re going to go on to build a service that is influential and that a lot of people rely on, then you need to be mature, right?” he said. “I think I’ve grown and learned a lot.”

Zuckerberg’s sophomoric former self, he insists, shouldn’t define who he is now. But he knows that it does, and that, because of the upcoming release of “The Social Network,” it will surely continue to do so. The movie is a scathing portrait, and the image of an unsmiling, insecure, and sexed-up young man will be hard to overcome. Zuckerberg said, “I think a lot people will look at that stuff, you know, when I was nineteen, and say, ‘Oh, well, he was like that. . . . He must still be like that, right?’ ”

In Hollywood’s version, the early founding of Facebook is, as Sorkin said in an interview, “a classical story of friendship, loyalty, betrayal, and jealousy.” Sorkin described Zuckerberg as a “brilliant guy who’s socially awkward and who’s got his nose up against the window of social life. It would seem he badly wanted to get into one of these final clubs”—one of the exclusive, élite-within-élite party clubs at Harvard. The Winklevoss twins were members of the Porcellian Club, the most prestigious.

In the movie’s opening scene, according to a script that was leaked online, Zuckerberg and his girlfriend, Erica, a student at Boston University, sit in a campus bar, exchanging disparaging zingers. (“You don’t have to study,” he tells her. “How do you know I don’t have to study?” she asks. “Because you go to B.U.!”) Erica takes his hand, stares at him and says, “Listen. You’re going to be successful and rich. But you’re going to go through life thinking that girls don’t like you because you’re a tech geek. And I want you to know, from the bottom of my heart, that that won’t be true. It’ll be because you’re an asshole.”

The movie is based on “The Accidental Billionaires,” by Ben Mezrich, a book about the founding of Facebook. Mezrich is also the author of a best-seller, published in 2003, about college students striking it rich. The book, titled “Bringing Down the House,” used invented scenes, composite characters, and re-created dialogue. The new book has been criticized for using similar methods. Mezrich says that the book is not “an encyclopedic” description of Facebook’s founding but is nevertheless “a true story that Zuckerberg would rather not be told,” written in what he called a “thriller-esque style.” The book draws heavily on interviews that Mezrich conducted with Eduardo Saverin, Facebook’s initial business manager, who had a falling out with Zuckerberg and sued him. Mezrich did not talk to Zuckerberg. (The producer of “The Social Network,” Scott Rudin, tried to talk to Zuckerberg and other Facebook executives, but he was rebuffed.) Mezrich sold the movie rights to the book even before it was completed. He called Sorkin his “first reader,” and handed over chapters as soon as he finished them.