Editor’s note: This article originally appeared in the March 19, 2012 issue of Fortune magazine. A shorter version appeared on Fortune.com on March 1, 2012.
FORTUNE — On a Friday morning not long ago, Mark Zuckerberg gathered his troops for a much-anticipated all-hands meeting at Facebook’s brand-new headquarters. It was billed as a not-to-be-missed event. Employees who were traveling were encouraged to return to the mother ship, and those in New York, Dublin, Hyderabad, and other satellite offices were told to watch via live stream. In Menlo Park, Calif., some 2,000 employees marched into a large white tent that was set up for big gatherings on a lawn across from the parking lot. The mood was effervescent, or as one employee described it, “part religious revival.” The pre-meeting buzz had people betting that Zuckerberg was finally ready to discuss the momentous event that would transform the eight-year-old company from hot startup into card-carrying member of the business establishment: Facebook’s IPO.
Zuckerberg had other plans. He mentioned the IPO only in passing. This was a gathering to discuss priorities for 2012, according to employees. In a sense, the purpose of the meeting was to remind everyone to stay on course even as Facebook prepared to undergo its biggest change yet. No matter what happens on the outside, Zuckerberg told employees, keep your heads down. “Stay focused,” he urged. “Keep shipping.” Twelve days after the January staff meeting, Facebook announced its plans to go public.
The 27-year-old co-founder and CEO has always displayed an almost preternatural ability to forge ahead with his lofty ambitions — to make the world a more open and connected place — even amid major distractions such as, oh, the release of an unflattering, Oscar-winning biopic. That sense of mission, coupled with a hard-charging, engineering-driven culture with Zuck himself at the center of it all, has propelled the company’s torrid growth: Today nearly one in every eight people on the planet uses Facebook. The site is transforming giant sectors of the economy, such as entertainment, media, and retail. What began eight years ago as a half-dozen overcaffeinated coders has morphed into a giant with 3,200 employees worldwide; its new campus alone will be able to eventually house nearly 10,000 workers.
Ever since he hatched the social network in his Harvard dorm room in 2004, Zuckerberg has fought to preserve the so-called hacker ethos that is at the root of how Facebook really operates. He’s largely succeeded: Facebook remains a place where engineers stay up all night to mock up new features. It’s a place where managers will scrap the site’s most sacred elements, like the traditional profile page, if there’s a potential for something better. It’s a place where the best ideas become products whether they were dreamed up by a lowly intern or Zuck himself. It’s a place where everyone takes to heart the dictates written on posters plastered all over campus: DONE IS BETTER THAN PERFECT and MOVE FAST. BREAK THINGS.
No one has written a management playbook for a company that is redefining the web while growing at warp speed. This story offers a rare glimpse inside Facebook, a company that has designed a set of rules for how to cultivate its own brand of chaos. Facebook declined to make top officials available, but conversations with several senior managers and dozens of additional interviews with current and former employees and executives paint a rich picture of a truly unconventional workplace. You’ll read how Facebook holds bootcamps to teach engineers to “think like Zuck,” forces people to change projects midstream, and even mandates all-nighters. And how this unusual approach has led to some of Facebook’s most important product developments, such as Timeline and Chat. It is also the canon that Facebook is trying hardest to impose on its more traditional businesses and marketing operations.
Facebook’s forthcoming IPO will cement Zuckerberg’s status as one of Silicon Valley’s iconic entrepreneurs alongside the likes of Bill Hewlett and David Packard, Larry Page and Sergey Brin, and even Steve Jobs. It will propel Facebook into the top echelons of corporate America, make multimillionaires out of hundreds of its employees, and give the company the financial might to go toe-to-toe with giants like Google GOOG, Amazon AMZN, or Apple AAPL. But becoming a publicly traded company may be the biggest threat to the culture of reinvention that has made Facebook a success thus far. Countless other startups were so transformed by their IPOs, through the pressures of quarterly earnings, the sudden employee wealth, and the sheer size, that they lost their edge.
What’s more, Facebook itself has already faced cultural challenges. Most notably, this is a company that operates as two symbiotic halves. One, Zuckerberg’s world, is a meritocratic, coder-led organization that develops the Facebook site; the other, which is charged with making money out of it, is subordinate. It is more hierarchical and corporate and is the domain of Zuckerberg’s handpicked deputy, Sheryl Sandberg. The arrival of Sandberg, a former Google executive, in 2008 was widely seen as a sign that Facebook was growing up, and hiring her by all accounts was a smart and much-needed move. Yet as the importance of the business side grows once Facebook goes public, the inherent tension between the two is certain to be magnified under the glare of Wall Street. It all amounts to the paradox that on the eve of its IPO, Facebook is a powerhouse, yet it feels a bit fragile.
And so, inside Facebook, executives are consciously working to codify its winning formula — essentially institutionalizing a sort of anarchic mentality — even as the company is about to be handed a very thick rule book from the SEC. They are creating training programs and communications tools (using Facebook, of course) that keep the company as lean and as fearless as a startup. After all, Facebook’s growth depends on the company’s adding new services and wooing new users without losing the attention of its existing 843 million users. So there’s no doubt an IPO will change Facebook. The question is, Will insane growth, market demands, and internal tensions hitting the company all at once chip away at its essence and spirit? Or will Zuck and his team navigate the turbulence successfully and emerge with a strengthened Facebook Way?
Mark Zuckerberg was distracted. It was December 2010, and a handful of his star engineers came to see him for what they expected would be something of a lovefest. Just days earlier the group had released a set of changes to the Facebook profile pages that had been months in the making, and early signs suggested the effort was a success. Millions of Facebook users had already opted in to the changes, and their feedback was overwhelmingly positive. Yet as the team delivered the good news to Zuckerberg, there were no high-fives and no pats on the back. Zuckerberg seemed aloof, his mind clearly elsewhere. Taken aback, one of the engineers asked him pointblank whether he was pleased. Showing little emotion, Zuckerberg said that of course he was pleased. But he was also worried. Facebook, he said, was about four weeks behind on its next, and more sweeping, profile redesign. “This is four days after having launched,” exclaims Andrew Bosworth, a director of engineering and one of Zuckerberg’s longtime confidants. Zuckerberg was not critical. He didn’t skewer anyone à la Steve Jobs. He was simply matter-of-fact about the shortcomings of the new profile pages and about what had to be done next. If there was some wounded pride among the engineers, they got over it quickly. “Of course by the time you finish a product, you should reconsider whether it was the right thing,” Bosworth says.
That, in essence, sums up the “hacker way” — the set of cherished principles that Zuckerberg and Facebook’s old-timers are trying to hold on to more than anything else as the company grows up. The word “hack” is plastered all around Facebook’s offices. While the main roadway around Apple’s campus is famously known as Infinite Loop, Facebook’s is called (what else?) Hacker Way. And in his letter to investors, Zuckerberg spent more time describing this approach than any other aspect of Facebook — including its mission and business. “The Hacker Way is an approach to building that involves continuous improvement and iteration,” Zuckerberg wrote. If the hacker way has one enemy, it’s the status quo.
In some respects, what Zuckerberg has sought to formalize in the hacker way is not unique. Web services — unlike computers, mobile devices, or even packaged software — lend themselves to tinkering and constant improvement. Companies like Google and Zynga ZNGA also roll out unfinished products and then fine-tune them on a nearly continuous basis. Yet at Facebook the allegiance to the hacker way goes well beyond the company’s approach to innovation, spreading to how it is organized, how its engineering ranks are managed, and how its employees are trained. At Facebook, the Hacker Way is capitalized.
Few at Facebook speak about this approach with more passion and devotion than Bosworth, an old-timer who is affectionately known as Boz. He joined in 2006, when the company had just 15 engineers, and helped build some of Facebook’s marquee features like its Newsfeed. Bosworth was among Zuckerberg’s teaching assistants at Harvard, making him one of a select few Facebookers that, in some sense, have been there essentially since the beginning. So it is not surprising that he has been entrusted to be one of the primary guardians of the hacker way — a task he takes as seriously as any other. “God forbid we spend a single day not trying to prepare for tomorrow’s Facebook,” Bosworth says. “You’ve seen company after company that rose to greatness struggle with scale, struggle with culture.”
It first dawned on Bosworth that Facebook could see its culture fizzle nearly four years ago. When he joined Facebook, everyone knew one another. Then one day in the summer of 2008, while in line at Facebook’s cafeteria, he met an engineer he had never seen before, so Bosworth asked him how long he had been at the company. The answer stunned him: a year. What’s more, Bosworth wasn’t even aware of the project that the engineer was working on. Something felt amiss. “We’re Facebook. If we can’t scale a communications network beyond 150, we’re in real trouble,” he says.
So Facebook began its first deliberate effort to nurture its values. It started with Bootcamp, a six-week program for new engineering recruits that Bosworth devised. After a quick orientation (where Bosworth and other veterans also speak about Facebook’s culture), bootcampers are given a computer and a desk. When they open their laptop the first time, they’ll often find six e-mails. One welcomes them to the company; the other five describe tasks they’re supposed to perform, including fixing bugs on the Facebook site. The goals are manifold. One is to get new employees comfortable with the idea that they have the power to push changes directly onto the Facebook site. “It is terrifying to ship code to Facebook and to think there are a billion people out there using this service,” says Jocelyn Goldfein, an engineering director. Another is to foster independence and creativity. At Facebook there isn’t one way to solve problems; there are many — and everyone is encouraged to come up with his own approach.
For Facebook to carry its hacker ethos from adolescence to companywide credo as new engineers have flooded in, Zuckerberg has had to train a cadre of leaders able to rise to the unique challenges of middle management in an organization that aspires to be flat. They are more coaches than bosses, more facilitators than gatekeepers. Their main role is to spot and encourage new ideas that everyone — anyone — can then show to Zuckerberg. Here, too, Bosworth’s Bootcamp helped kick-start the process. Bootcampers are paired up with mentors who help them navigate those first few weeks. The mentors, in turn, gain leadership experience, and those who opt or are chosen for a leadership or management track get to develop their skills through a series of brown-bag lunches with other managers. In groups ranging in size from five to nine, they discuss various management challenges with their peers and superiors. This process for grooming managers is particularly important because Facebook had largely been built by engineers in their twenties who had never worked anywhere else and who, while great at building the site, had paid no heed to building a sustainable corporate culture.
But even as it develops new leaders, Facebook is doggedly trying to avoid becoming too hierarchical or set in its ways. It has kept the organization nimble. Every year or 18 months, engineers are required to leave their teams to work on something different for at least a month. The swaps can be uncomfortable for many who have developed expertise in a particular area. But ultimately, more than a third of engineers end up transferring to a new team at the end of their month-long gig. This process constantly brings new blood and ideas to engineering teams, and it prevents managers from establishing fiefdoms.
To keep this always-changing organization from choking on itself, the company uses a tool to keep everyone informed and in sync: Facebook. Engineers communicate with their teammates, stay abreast of the work of other groups, and track bugs in the system not through e-mail but rather through Facebook Groups and Messages.
All this has helped with Zuckerberg’s goal of keeping Facebook’s product development as unmanaged as possible. Zuckerberg himself is not fond of staff meetings with his direct reports, a feature of most corporate organizations. He prefers to interact directly with the people who are working on products, drilling down on details no matter how small. He frequently walks around the engineering offices, often in the evenings, to see what various groups are up to. And he holds office hours. Feross Aboukhadijeh remembers popping into Zuckerberg’s office during a recent internship to show off a feature he’d mocked up in his spare time. “If you believe something is good, then show it to everybody else,” says Aboukhadijeh, a Stanford senior. “If it’s really that good, everybody will see it and agree with you.”
Development teams are kept as small as possible — sometimes ridiculously small — in the service of speed. It’s an austere approach to product management taken directly from the Apple playbook that is perhaps best illustrated by the launch of the ubiquitous “Like” button, one of the most recognizable and important features of Facebook. It was developed by a team of just three people: a product manager, a designer, and a part-time engineer who also taught at Stanford. About once a week the team met with Zuckerberg to go over intricate details: the look and feel of the button, the beveling of the corners of the icon, and what actually happened when you clicked on it. “We went through probably like dozens of iterations of that until we found something we were really happy with,” says Mike Vernal, an engineering director who oversaw the project. Make no mistake, when Vernal says the team was happy with the product, he means Zuckerberg had signed off.
In a company that is driven first and foremost by its product, Zuckerberg is the ultimate arbiter of matters big and small. He is the person who came up with the original idea of building a “social utility,” as he spelled out in an exclusive interview in 2005. He is the person who pushed that idea forward by turning his website into a platform for third-party applications. And he’s the person who will not only weigh in on minute details but also get his hands dirty to get them just right. That’s just fine with the legions of engineers because around Facebook, the cult of Zuck is downright Jobsian in its intensity. Engineers are romanced by the size and scope of his vision; for many, winning his approval is its own reward. He is less a dictator than a guru for these coders, and of course his opinion is final. Says Boz: “The reason Mark has final word is because he is fucking brilliant.”
The cornerstone of Facebook’s ethos is the hackathon, an all-night workfest that happens at Facebook every few months. It’s the ultimate test of mettle for Facebook’s engineers, a chance to try out that otherwise crazy idea. As one engineer describes: “Your body’s like, ‘I’m hungry; I’m tired; I want to go home.’ Your brain’s like, ‘No, no, no, this can become something real.’ ” The basic rule of a hackathon is simple: No one is allowed to work on what he normally does. The goal is to dream up potential new products and show them to Zuckerberg and other top managers who will decide which ones go forward.
This somewhat chaotic process hatched Facebook’s most important recent new product: Timeline, which transforms users’ profiles into a visually rich chronology. Zuckerberg had long had the idea to expand Facebook’s profile pages so they would tell a more complete story of a person’s life. He tapped Sam Lessin, a buddy of his from their Harvard days who had recently joined the company, to rethink them entirely. Separately, a couple of engineers came up with a product called Memories during a hackathon. It allowed people to see all the photos they had posted in a given year. Employees inside Facebook, where the company often tests out experimental features, loved it, and many turned it on and started to play with it. As the project grew, an engineer from the Newsfeed team mocked up a prototype for ticker, a feature that publishes friends’ actions in real time. Zuckerberg noticed themes emerging, and helped these efforts converge into what would become Timeline, Facebook’s completely redesigned homepage. “Timeline was like this wave that over a couple of months swept the entire company with it,” says Serkan Piantino, an engineering manager.
Healthy dissent — including dissent with the boss — is encouraged at Facebook, and mock-ups are favored over conversations. Time and again engineers hacked prototypes for a service that would allow Facebook users to chat with one another. Time and again Zuckerberg and other top managers shot down the idea. Eventually, the prototype proved so compelling that the higher-ups were forced to reconsider. Facebook chat has been a runaway success. It’s an example of a phrase that’s often repeated inside Facebook: Code wins arguments. The company prizes people who, despite being told by Zuckerberg their idea isn’t very good, “still believe in it enough to go build a prototype of it to prove him wrong,” Bosworth says. Thing is, Bosworth says about Zuckerberg, “he’s happy to be proven wrong.”
There’s a term spoken quietly around Facebook to describe a cadre of elites who have assumed powerful positions under the leadership of Zuckerberg’s chief operating officer: They’re FOSS, or friends of Sheryl Sandberg. Many have followed her there after studying with her at the Harvard Business School or working with her at the U.S. Treasury Department or Google. Several middle and senior executives who have left the company say that Sandberg has put friends in powerful positions, sometimes even when they were less qualified than other Facebook employees, and once there they enjoy special status. “You can’t really cross a FOSS,” says one former senior manager.
The point isn’t that people grumble — what corporate organization doesn’t have grumblers? — but that the business side of this company runs by somewhat different norms. It’s where the chaotic and meritocratic hacker way yields to a more traditional corporate culture. It wasn’t always this way. Early on, Zuckerberg presided over both sides of the business to poor effect. Sandberg arrived amid a fractured management culture that had suffered from high turnover. One president, two CFOs, one COO — folks like Gideon Yu and Owen Van Natta — and all three of Zuckerberg’s co-founders had either chosen to leave or been pushed out. And over the years a handful of vice presidents and senior executives also left. (Contrast that with Google, which lost virtually none of its senior staff until months after its IPO.) By instituting more corporate processes and hiring a slew of new, more seasoned managers, Sandberg brought stability and the discipline needed to turn Facebook into a business with global reach. And along with clear chains of command have come the accompanying egos and politics anyone might expect.
Sandberg’s management style is very professionalized; she pairs empathy with high expectations and regular direct feedback, and she values entrepreneurial problem-solving above all else. When former Dell technologist Frank Frankovsky was interviewing for his current job as director of technical operations, his most nerve-racking conversation was with Sandberg, even though he was applying for a position in a part of the company she doesn’t oversee. He recalls that upon learning what he was being hired to do, she asked him point-blank, “Why should we even do that?” He was caught off guard. He had chatted amicably during his interview with Zuckerberg on the seemingly esoteric topic of thermodynamics, after all. But Frankovsky collected himself and explained how he could help Facebook think more broadly about infrastructure. The conversation then took off. “I think she was testing to see if I was open-minded,” he says.
Sandberg and others have also worked hard to integrate the two halves of Facebook. It helps that she and Zuckerberg share a similar staffing philosophy: Both hire smart people independent of available job openings and then help them identify their top talents in what HR head Lori Goler characterizes as a “strengths-based organization.” With Sandberg’s enthusiastic backing, Goler began requiring that every Facebooker complete a computerized test licensed from Clifton StrengthsFinder (created by Donald Clifton, the inventor of strengths-based psychology) to identify hidden talents. Many employees worked with their managers to redefine their jobs based on the results. Now every “nube” takes the test.
To bridge the cultural gap between the makers and the sellers, Facebook has attempted to bring its hackathons to every division. Yet its efforts can feel forced. When David Ebersman, the CFO, early in his tenure conducted a hackathon to draft a multiyear budget, he described the project as a “nice tie-in with the culture” rather than a serious effort at financial planning.
Just as Facebook asks users to reveal more and more about themselves, the company aspires to full transparency and communication across its business and product sides. Every Friday afternoon Zuckerberg chats with employees during an hourlong Q&A, as Sandberg and others stand at the ready to answer questions. Beer is served, and at the end Zuckerberg asks Facebookers to share their own stories about things they’ve seen. And at a high level, Zuckerberg and Sandberg communicate a lot too. By design, Sandberg is embedded far from her charges, among the engineers, where her desk abuts that of her boss. They meet to review their priorities first thing on Monday morning and last thing on Friday afternoon. And it appears they have a pretty good rapport: Zuckerberg pulled a prank on his COO last fall by mounting the bulbous taxidermied head of the bison he’d hunted himself (nickname: Billy) on her orange conference room wall. (Billy is now in storage.)
As essential as Facebook’s business side has become, the entire operation has had to shift direction on the whims of a founder who isn’t prioritizing most of what it holds important — be it designing to appease privacy watchdogs or creating more opportunities for revenue. Consider the launch of Facebook’s ticker, the list of real-time interactions that now appears next to the Newsfeed. The ads were among the last considerations, even though the new design meant that users would see two ads instead of three on their main feeds. “Mark decides what to do with the product, and everyone has to figure out how it will affect them,” says a Facebook veteran. “It’s not a discussion. It has a whiplash effect on everyone — and it’s part of the genius.”
And though Sandberg has been able to manage that whiplash with grace, it’s increasingly clear that her long-term ambitions may extend beyond Facebook. No one believes Sandberg plans to leave Facebook anytime soon, but she is not one to occupy shadows. In recent years she has used high-profile forums to cement her role as spokeswoman for a new generation of women in the workplace. Days before the IPO filing, she was in Davos, Switzerland, as co-chair of the World Economic Forum. To be sure, a big part of her job is to be the face of Facebook with advertisers and partners, and the attention she’s gotten from world leaders has been an asset. It has also helped with recruiting. But some former employees complain that her extracurricular activities are so encompassing, they distract her from the business. And those people say that she is inconsistent; internally, she encourages others to keep a low profile, but she embraces the spotlight, which “made some people unhappy and some jealous,” says a former executive.
Now that Facebook has filed to go public, it is officially in the limbo between its early life as a startup and the beginning of its adulthood. It’s a transition that Zuckerberg has sought to delay as long as possible, both because he worried about losing control of his baby and because he fretted that the hacker culture that has been at the root of Facebook’s success until now risked being diluted in the aftermath of an IPO.
Zuckerberg has taken care of his first concern rather effectively. As he offers a piece of Facebook to the public, he will retain ownership of about 22% of the company’s equity and 57% of its voting shares. It may not be a shareholder democracy, but it’s an arrangement that should allow Zuckerberg to stay true to the unconventional priorities he outlined in his letter to investors: “We don’t build services to make money; we make money to build better services.”
Zuckerberg is mindful that, public or not, Facebook’s ability to stay nimble erodes as it grows and ages: Nearly every fast-moving, innovative company in the world of tech reached a point where it struggled with bloat and bureaucracy. It happened to IBM IBM and Intel INTC. It happened to Microsoft MSFT in the late 1990s, as hundreds of its newly minted millionaires lost their hunger. At Google, CEO Larry Page recently has had to restructure the company along a handful of product lines to streamline it and make executives more accountable. In December, Zuckerberg followed suit, restructuring Facebook along five product areas to streamline decisions and create clear lines of accountability, though Facebook is a 10th Google’s size. The move suggests that the company was already seeing the first signs of innovation-slowing bureaucracy — and that’s a problem even Zuckerberg won’t easily be able to hack his way out of.