Line Counter
Professional text and code line counter. Features whitespace trimming, empty line filtering, and local file analysis for developers and content creators.
Drag & Drop file here or Click to Upload
.txt, .js, .py, .html, .css (Max 10MB)
About
Counting lines of code (LOC) or text segments is a fundamental requirement in software development, content auditing, and data processing. Precision matters when billing clients based on source code volume or strictly formatting data for legacy systems. A standard text editor often obscures the difference between a truly empty line and one containing invisible whitespace characters like tabs or spaces.
This tool processes raw text and uploaded files to distinguish between total lines, non-empty lines, and purely whitespace lines. It handles cross-platform inconsistencies regarding line breaks, specifically the difference between Windows CRLF and Unix/Linux LF standards. Visual verification ensures that hidden characters do not inflate the final count.
Formulas
The calculation defines the set of lines L derived from the input text T. The counting logic adjusts based on the presence of whitespace characters when Trim Mode is active.
Where trim removes leading and trailing whitespace W (spaces, tabs) from line li. The difference defines the empty line count.
Reference Data
| Standard | Symbol | Hex Code | Operating Systems | Impact on Count |
|---|---|---|---|---|
| Line Feed | LF (\n) | 0x0A | Linux, macOS, Unix | Standard break. Counts as 1 new line. |
| Carriage Return | CR (\r) | 0x0D | Legacy Mac (Pre-OSX), Commodore | Often ignored or treated as overwrite in modern editors. |
| End of Line | CRLF (\r\n) | 0x0D0A | Windows, MS-DOS | Two bytes, but logically represents one line break. |
| Next Line | NEL | 0x85 | EBCDIC Mainframes | Rare. Requires specific encoding parsers. |
| Line Separator | LS | 0x2028 | Unicode Systems | Used in specific high-level formatting protocols. |
| Paragraph Separator | PS | 0x2029 | Unicode Systems | Defines block boundaries rather than visual lines. |
| Null Character | NUL | 0x00 | Binary Files | Terminates strings in C-based languages. |
| Vertical Tab | VT | 0x0B | Legacy Printers | Moves cursor down without carriage return. |