100 real comments. The 8 in green explain why. Click any line to read it inside its code.
Who are code comments for?
I've had my share of swear words, usually every time I missed a semicolon. And that sent me down a rabbit hole: what about everyone else? What do other programmers write when the code fights back?
So we pulled every comment out of 64 big projects on GitHub. That's 295,820 comments. Then we went through them and asked one question about each: who is this written for?
295,820 comments 64 projects, read 23 to 26 November 2026
Every programmer hears the same advice: a comment should explain why the code does something. So we checked how many actually do.
100 comments
Here are 100 of them, picked so they look like the whole lot.
51 in 100
just say what the next line does.
Like # create the axes, sitting right above the code that creates the axes.
31 in 100
are written for documentation tools, the ones that turn comments into help pages.
8 in 100
explain why the code is written the way it is.
Like this one from Ansible: // Cannot call Warn as that calls LogEvent and we get stuck in a loop
4 in 100
are legal text, like copyright notices.
2 in 100
are notes for the computer, not for people.
Like // eslint-disable-next-line, which tells a code checker to skip the next line.
1 in 100
is a person talking: a TODO, a warning or a sorry.
The last 3 are labels, like // Arrange in a test.
Every language does it differently
11 in 100
Java comments are legal text, almost all of it the same Apache licence.
12 in 100
Ruby comments are the exact same line: # frozen_string_literal: true. It’s a setting for Ruby, not a note for people.
53 in 100
Rust comments are documentation. Rust can turn them into a website with one command.
61 in 100
C comments just say what the next line does.
The longest one
1,051 lines
That’s the longest comment we found. It’s in Rails, and it’s a whole help page written inside the code.
Lines 114 to 1,164 of associations.rb. The pandas help page for read_csv is one comment too, 497 lines long.
The swearing
24 times
more swearing in C comments than in Java ones. C# didn’t swear once in 373,000 lines.
Each line here is one swear per million lines of comments. We left Linux out, because it’s so big it would skew C on its own.
The promises
500 to 1
That’s how many promises there are for every sorry. Promises like TODO, FIXME or “temporary fix”.
59 of these 100
TODOs point to a GitHub ticket that’s already closed. The TODO is still sitting there.
116 sorries
That’s all we found. Here are 84 of them, still in the code.
// Sorry for indentation here; line wrapping would be uglier. (Protocol Buffers)
Get the next one by email
A new story drawn from data, about once a week. You can leave any time.
How we sorted them
We picked 64 big projects on GitHub. From each one we took up to 400 code files at random and kept every comment in them: 295,820 in all.
Simple rules put each comment in one group. If it wasn't legal text, a machine setting, documentation, a label, a person talking or a reason, it went in "says what the next line does".
Rules get things wrong, so we checked 120 by hand. Some "why" comments weren't, and some "what" comments were. It still comes out at about 8 in 100.
The swearing, TODOs and sorries come from a bigger search: 14.9 million comment lines in 345 projects. A line repeated in one project counts once.
Read them yourself
Here are 4,970 of them. Click any one to read it inside its code. Pick a kind or search for a word.
Loading the comments…
Back to me
I went looking for other people’s swearing. In 14.9 million lines of comments, we found 312. That’s about one every 48,000 lines.
Turns out people mostly don’t swear in their code. They write TODO instead. We counted 41,325 of those.
Get the next one by email
A new story drawn from data, about once a week. You can leave any time.
We also make Long Story Short, a daily game where you cut a real news story down to five words.
Our members-only drops live in the Hidden Tab, and one of them is free to read.
The comment is in green, with the code around it.Open on GitHub