What port numbers do programmers like to use?

April 30, 2020

A couple of days ago, I was working on a web server, and I got stuck on the “tell the server to listen on localhost:3000” step. Why was I using port 3000? For local development, it’s a meaningless and arbitrary choice. That got me to wondering: what port numbers do others choose use when developing software?

So I did what anyone would do in this situation and decided to search GitHub for references to localhost:n, for all possible values of n. I wrote a little program that gets the number of GitHub search results for "localhost:n" for all possible port numbers, then made this interactive heatmap:

If you don’t see a diagram above this sentence, or if you’d like to see more details, the full graphic is on Observable. A few notes:

  • This is obviously really noisy data (look at the popularity of “port” 127, for example, likely an artifact caused by my search query matching “localhost”).
  • People like round numbers and repeating digits.
  • This data took a few days to collect. GitHub only lets you issue 30 search API requests per minute, and in practice they throttled my scraper’s requests even more aggressively than that, due to its apparently-suspicious activity. Fair enough.