What does a line counter do?
A line counter reports how many lines a block of text contains and then breaks that total down into the numbers people actually want. It counts the total lines, how many are non-empty, how many are blank, the longest line and its length, the average length of the non-empty lines, the word and character counts, and how many lines run past a limit you choose. Everything is recomputed as you type, so adjusting a paragraph updates every figure at once.
The count is trivial to produce but surprisingly easy to disagree about, because a line is a convention rather than a fact. A file that ends without a newline has one fewer break than it has lines, while a file that ends with one carries a trailing empty line that some tools count and others discard. That is why the same document reports different totals in two editors, and why the breakdown here keeps blank lines visible instead of quietly folding them away.
The second half of the job is the maximum line length, because that number drives how the text behaves somewhere else. A line past about eighty characters is awkward in a diff, a terminal or a commit column; a line past 998 characters in an email body may be wrapped by a relay in a way that mangles it; and a single line running to thousands of characters usually means a minified file or a paragraph that lost its breaks. Flagging the lines past a limit you set turns the count into a check rather than a curiosity.
How to count lines in text
- Paste or type the text into the box; every line break is counted as you go.
- Read the totals on the right: lines, non-empty lines and blank lines, which together account for the whole text.
- Check the longest line and the average length, which together describe whether the text is loosely or tightly broken.
- Set a character limit — eighty is a sensible default for code and prose — and see how many lines exceed it.
- If any do, the longest offending line is shown so you can decide whether the break is missing or intended.
- Copy the whole set of counts, or clear the box and measure a different block.
Line Counter limits and rules
| Item | Limit |
|---|---|
| Input | Any plain text; pasted or typed, of any size the browser can hold |
| Line detection | LF, CRLF and CR are all treated as a single break |
| Counted | Total lines, non-empty lines, blank lines, words and characters |
| Length figures | The longest line and its content, and the average over non-empty lines |
| Limit check | A character limit you set, with a count of the lines over it |
| Characters | Line breaks excluded by default; a tick includes them |
| Not covered | Rendering, pagination, or counting the lines a file would occupy in a layout |
When to use it
- Checking that a file ends the way a tool expects, with or without a trailing newline.
- Finding which line in a document is running past a conventional width.
- Confirming a line count before citing a document or a code review.
- Measuring how much of a draft is blank lines rather than content.
- Getting a quick word and character count alongside the line count without a second tool.
Is it private?
The counts are worked out in this page from whatever you type. Nothing is uploaded, stored or logged, and the text disappears when the tab is closed.
Frequently asked questions
Almost always the trailing newline. If a file ends with a break, one definition of a line sees a final empty line and another does not, so the totals differ by one. Editors that add a newline on save are the usual culprit, and the same document can then show a different number to anyone who opens it elsewhere. The blank-line figure here makes the discrepancy visible, since a trailing empty line appears there rather than hiding inside the total.
In the total, yes, because it is one — the text contains a break with nothing between it and the previous one. It is excluded from the non-empty count and from the average length, since including it would drag the average towards zero and say nothing useful about how the real lines look. Both numbers are shown, so you can read the figure that matches whatever convention the tool you are comparing against uses.
For code, eighty characters is the long-standing convention and still the default in many formatters; a hundred and twenty is common where wider screens are assumed. For prose, the limit is about readability rather than tooling, and sixty to eighty characters per line is roughly where the eye travels comfortably. For email bodies, keep lines under 998 characters, and preferably under 78, because relays are allowed to wrap longer ones and that wrapping can corrupt structured content.
Because that is the question people are asking when they look at it: how long are the actual lines. Including blank lines would pull the figure down in proportion to how much whitespace the document uses, which measures formatting rather than line length. The blanks are counted separately and the character total is shown as well, so the stricter figure can be worked out by hand if you need it.
It will, up to whatever the browser can hold in memory, and a text file of several megabytes is usually no trouble. What it cannot do is work as a stream, since the whole value is measured on every keystroke — so a genuinely enormous file is better counted with a command-line tool that reads it line by line. For drafts, source files and pasted text, the practical ceiling is far above anything you would type.
No. The character count is what you see, while a file's size on disk depends on the encoding: plain ASCII text is one byte per character, but accented letters, emoji and non-Latin scripts take two or more bytes each in UTF-8. So a thousand-character document can easily be a two-thousand-byte file. Use this figure for the length of the writing, and a file manager for the size it occupies.
Related tools
Written and maintained by Md. Nur Hossain Repon.