One of the hottest startups in Silicon Valley almost didn’t become a company. In 2004, Matthew Prince, a lawyer out of the University of Chicago who ditched law for an entrepreneurial life, and a friend, Lee Holloway, launched a free network for tracking spam. An open-source system, Project Honey Pot was a huge success — and still exists. But not until several years later, when Prince was pursuing a Harvard MBA, did he think to develop the idea into a company that could shield websites from rising security threats.
So in 2009, Prince, Holloway, and HBS student Michelle Zatlyn started CloudFlare. Traditionally when a user types in a web address, his web browser sends a request to access the site’s servers. CloudFlare acts as a virtual middleman, fielding requests and neutralizing threats. The startup also stores some of its customers’ content on servers across the U.S., Europe, and Australia, an approach that enables pages to load superfast because the content is located closer to the web surfer. It’s an approach not unlike that of older rival Akamai Technologies (AKAM), but CloudFlare uses a freemium model: A free basic plan promises sites speed tweaks and protection. Paid options serve up faster performance and deeper security features. As Prince likes to point out, his little startup now signs up as many as 5,000 new users a day, roughly the size of Akamai’s entire client base.
The freemium model lets San Francisco-based CloudFlare reach small businesses and individual webmasters, like the teenager whose site was targeted by hackers who tried to take it down by flooding it with useless data requests. (CloudFlare declined to name the teen for privacy reasons.) The distributed attack pushed 400 gigabits of data per second at the site. Most sites would have buckled, but the CloudFlare customer’s was unscathed. “We use thousands of signals across our network [such as whether a visitor is a regular],” says Prince, “to decide whether someone is ‘good’ or ‘bad.’ ”
Hobbyists aren’t the only ones using CloudFlare. Customers include eHarmony, Gilt Groupe, and the Franklin Mint.
CloudFlare’s success has made it one of the hottest investments in the startup world. In December 2012 it raised $50 million from backers like Union Square Ventures, New Enterprise Associates, and Venrock. Its valuation of $1 billion puts it in the same league as private companies like Evernote.
Despite such heady numbers, Prince says the company is focused on thwarting hackers, a job that not only keeps CloudFlare very busy but also makes its product better: With each attack, the startup’s digital security network gets smarter as it gains information from customers’ sites. Outfoxing the attack earlier this year didn’t just keep a teen’s website up; data from that failed assault let CloudFlare foil similar attacks on large financial institutions.
This story is from the June 16, 2014 issue of Fortune.