Code Line Counter
Count total, blank, comment, and code lines in any pasted code with language auto-detection.
About this tool
The Code Line Counter analyses pasted source code and breaks it down into four categories: total lines, blank lines, comment lines, and actual code lines. It automatically detects the programming language based on syntax patterns and applies the correct comment rules — double-slash (//) for JavaScript, TypeScript, Java, C, C++, C#, and Swift; hash (#) for Python, Ruby, Shell, and YAML; double-dash (--) for SQL and Lua; block comments (/* … */) for C-family languages; and HTML/XML comments (<!-- … -->). Results are displayed with progress bars showing the proportion of each line category, making it easy to gauge comment density and blank-line ratio at a glance. Useful for code review, metrics reporting, estimating documentation coverage, or satisfying coding standards that require a minimum comment ratio.
How to use
- 1 Paste your source code into the textarea.
- 2 The tool auto-detects the language and displays a label.
- 3 Override the language using the dropdown if detection is incorrect.
- 4 Read the four counters: Total, Blank, Comment, and Code lines.
- 5 Check the progress bars to visualise the proportion of each category.
Frequently Asked Questions
Format, validate, and minify JSON — with syntax error pinpointing.
Test regular expressions with real-time match highlighting, capture groups, and replace mode.
Generate UUID v4, UUID v7, ULIDs, and Nano IDs — bulk generation with one click.