How to Hack Hacker News

It’s not a stretch to say that most modern day tech teams dream of going viral on Hacker News. A popular news aggregation website, Hacker News is a reading list for the tech community. Going viral on Hacker News can mean important eyes on your new product, notoriety, and street cred, but it’s not easy to make the front page. Topping the charts can only be achieved by the most inventive product, the perfect sense of humor, and the right reputation—unless, of course, you can hack it.

That’s why the team at Codecademy wants to teach you how to analyze the Hacker News algorithm while learning SQL. Find out exactly what makes a post successful on Hacker News, using nothing more than publicly-available data and a few SQL queries.

What is Hacker News

Hacker News is a social news aggregation website with a focus on tech and entrepreneurship. The site was started by Paul Graham, co-founder of the seed accelerator Y Combinator, in 2007.

In the decade since its launch, Hacker News has become an influential source of tech news and discussion, thanks in part to its Y Combinator connection. The site saw roughly 2.6M views a day, 300K daily uniques, 3 to 3.5M monthly unique views in 2015 according to Daniel Gackle, one of the site’s moderators.

Users are tech-savvy and keenly aware of where the industry is moving because, in many cases, they’re the people moving it. One of Graham’s initial goals for Hacker News was to allow Y Combinator to “get to know would-be founders before they apply,” so applicants can use the same Y Combinator account to contribute to Hacker News and apply to the accelerator program. That means many of those upvoting and commenting on stories will go on to make headlines themselves one day.

The front page of Hacker News.

Over the past decade, the site has become relevant to more than just the Y Combinator community. The eyes of Hacker News users can translate into lasting success for anyone who understands how to capture that attention.

How does Hacker News work?

The backbone of Hacker News is a system similar to Reddit’s upvoting and downvoting system, with one key difference. Users can’t downvote submissions or comments until they’ve accumulated 501 karma, and they can’t flag comments until they’ve accumulated 30 karma. Historically, this has made for more civil and measured discussion than similar online forums, and it’s prevented coordinated downvoting.

What’s resulted is a platform that’s more meritocratic than most. It’s harder for marketers, founders, and friends to coordinate an upvoting brigade that could send a post about their new product to the front page of other aggregation websites, or a downvoting brigade that would sink their competitors.

That said, the success of a submission is still subject to a few factors separate from the quality of the submission itself.

Karma: For individuals, karma is calculated by subtracting the number of downvotes they’ve received on submissions and comments from the total number of upvotes they’ve received. While the Hacker News algorithm doesn’t explicitly weight a submitter’s karma when ranking their submissions, it’s an important part of the equation because a submitter's username is just as visible as the title of their submission. For all its influence, the Hacker News community is small, and users want to upvote peers with established reputations.

Source: Beyond the submitter’s reputation, the source of a submission also plays a part. Like Reddit, the URL that a submission comes from is displayed adjacent to its headline.

Timing: As on every other social platform, timing is key. According to Hacker News, the basic algorithm for ranking submissions to the site “divides points by a power of the time since a story was submitted.” That means the performance of a submission immediately after it’s shared is critical to its success. The difference between a submission going viral and going unnoticed could be the number of users online to upvote it right after it’s submitted.

How do you hack it?

The project in Learn SQL from Scratch uses a real dataset to investigate the impacts of karma, source, timing, and other factors on a submission’s success. With the dataset and a few SQL queries, participants uncover the qualities that successful past submissions have had in common.

The project in Codecademy's learning environment.

The dataset is made up of a sample of 4,000 submissions to Hacker News dating back to its launch in 2007. Each row in the table carries data on the title of the submission, the user who submitted it, the score it received, the time it was submitted, and its URL.

This is enough to start figuring out what works on Hacker News.

The first step is determining the importance of being a power user. The goal of this part of the exercise is to determine whether or not a small percentage of Hacker News submitters account for the majority of the karma accumulated on the site. The verdict: just four power users accounted for 22% of the total karma in the dataset.

The next step is using CASE statements to determine which websites feed Hacker News the most. These queries reveal that Github, the New York Times, and Medium are the sources the Hacker News community trusts the most.

After determining the best sites to submit from, participants determine the best time to post on Hacker News.

Whether you’re a Hacker News devotee or not, you probably know that social media success is all about timing. The Sunday afternoon Instagram dump is a time-honored tradition at this point.

This is the portion of the project that Sonny Li, one of the curriculum developers who designed the project, is most excited about:

“I am always posting shenanigans and chasing karma on Hacker News and Reddit. This project was super fun to build because I wanted to see whether or not timing is a contributing factor behind HN stories that make it to the front page.”

The project’s final query produces a table listing every hour of the day and the corresponding average score of posts shared within that time frame.

The table produced by the project's final query.

So when is the best time to post something on Hacker News? It seems the community is most active on the bookends of the work day on the East Coast—articles shared around 7am EST, and then between 6 and 8 pm, have the highest average scores.

Key Takeaways

  • The best times to post on Hacker News are in the morning around 7 am EST and in the evening between 6 and 8 pm
  • Github, the New York Times, and Medium are the sources most trusted by the Hacker News community
  • Four power users accounted for 22% of the total scores in the sample dataset, so having an established reputation pays off

Learn SQL from Scratch also features projects that utilize real datasets from the Metropolitan Museum of Art, IMDB, and various New York City restaurants, as well as a project created in collaboration with the team at Warby Parker.

Get more practice, more projects, and more guidance.