Lines of code, comments and blanks
Choose a language, then paste your code or open a file. The counter splits every line into code, comment or blank, and shows each as a number and as a share of the file. A line with code followed by a trailing comment counts as code.
How comments are found
- Line comments such as // or # make the whole line a comment when they start the line.
- Block comments, such as /* to */ or the HTML comment markers, are tracked across lines.
- Blank lines inside a block comment are counted as blank.
Limits to know about
This is a quick estimate, not a full parser. Comment markers inside strings can be misread, and Python docstrings are counted as code. For reports on whole projects, use a command line tool such as cloc.
Using the numbers
Lines of code help estimate size, compare versions and plan reviews. They are a poor measure of productivity or quality, so use them as context rather than a target.
For total lines of any text use the line counter. To drop blank lines, try the non-empty line counter. The guide covers counting lines in the terminal.