Batch text file line counter
Count lines, blank lines, non-blank lines, characters and bytes for several text files at once, with a totals table and CSV export. Blank-line and trailing-newline conventions are configurable, and large files are read in 4 MiB chunks so nothing is uploaded.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Pasted text counts as one entry. You can also pick several local text files; they are read locally through the File API and never uploaded.
Files are read in 4 MiB chunks with a streaming UTF-8 decoder, so a huge file is never loaded into memory at once; one file is capped at 1 GiB and a leading UTF-8 BOM is stripped automatically.
Counts
The table is aligned by East Asian width (fullwidth = 2 columns); bytes come from the real file size when available, otherwise from the UTF-8 length.
Paste text or choose files to see the counts
What this tool does
- Check line and character budgets for submissions, subtitles or copy: count lines, blank lines, non-blank lines and characters of several files in one go.
- Compare two versions of the same dataset: drop both files in and read the difference in lines and bytes straight off the table.
- Keep an auditable record of “N lines of code / N lines of dialogue”: export the CSV, and note that the blank-line and trailing-newline conventions are configurable.
Example
Input
a b c
Output
File Lines Blank Non-blank Characters Bytes Pasted text 4 1 3 6 6 Total 4 1 3 6 6
Default conventions (only truly empty lines are blank, a trailing newline adds no line): 4 lines, 1 of them blank, and both the character and byte counts include the newline characters.
Frequently asked questions
How are lines counted, and does it match wc -l?
The default convention matches editors and wc -l: a trailing newline does not create an extra line, so "a\nb\n" is 2 lines and an empty file is 0. Switching “trailing newline” to “counts as a line” turns "a\nb\n" into 3 lines, which is what line-by-line scripts often report. CRLF, a lone CR and LF each count as one break; the original line-ending style is not preserved in the output.
What is the difference between the two blank-line rules?
“Only truly empty lines count as blank” counts only zero-length lines; a line containing spaces or tabs is treated as non-blank. “Lines with only spaces / tabs also count as blank” trims first, which suits text where those lines look empty. Blank lines are never dropped — they still count towards the line total.
What exactly are the character and byte counts?
Characters are Unicode code points (an emoji or an ideograph counts as one) and include the newline characters. Bytes come from the real file size in the browser (File.size); pasted text uses its UTF-8 length, also including newlines. Note that decoding is UTF-8 only: GBK / GB18030 files come out as mojibake and their character counts will be wrong, while the byte count stays correct.
Will a huge file freeze the page?
The file is never loaded into memory as a whole: it is read in 4 MiB chunks with a streaming UTF-8 decoder and an incremental line counter, so multi-byte characters split across chunks and CRLF split across chunks are merged correctly. One file is capped at 1 GiB; larger files are reported and skipped. Text pasted into the box does live in memory, so prefer picking a file for very large inputs.
Can I export the counts?
Yes. “Download CSV” exports a CSV with a UTF-8 BOM (so Excel shows Chinese correctly) containing the same rows as the table, with a totals line at the end. Everything runs locally in your browser — file contents never leave your device.
Keywords:wc -lline countercount lines in txttxt-line-count