What is a line counter?
A line counter tells you how many lines are in a piece of text. Paste in a poem, a list, a log file, or a chunk of code, and it counts the lines instantly. The default text on this page has 5 lines in total, 4 non-empty lines, 46 characters, and 8 words — because line 3 is blank, and the blank line counts toward the total but not toward the non-empty count.
The need comes up whenever a limit or a price is set per line. A poem must be 14 lines. A code file must stay under 200 lines. A data file must have exactly 1,000 rows. A translator charges per line. In each case, the writer needs a number, not a guess — and counting lines by hand is slow, boring, and wrong.
This counter covers the numbers people actually check: total lines, non-empty lines, characters, and words. Paste or type your text, and every number updates live as you type. Everything runs in your browser — your text never leaves your device, nothing is stored, and there is no account to create.
How a line counter works
Counting lines sounds simple, and the basic rule is simple: split the text on line breaks and count the pieces. The default text has 5 lines because it has 5 pieces separated by line breaks: First line, Second line, an empty piece, Fourth line, and Fifth line. The empty piece is line 3, and it counts.
Non-empty lines are counted separately. A line counts as non-empty if it has at least one character that is not a space — so a line with only spaces counts as empty, and a line with a single letter counts as non-empty. The default text has 4 non-empty lines, because only line 3 is blank. The difference between 5 and 4 is the whole point of the tool: most limits mean non-empty lines.
Characters count everything you typed, including spaces and line breaks — the default text has 46. Words are counted by splitting on whitespace, so the default text has 8: First, line, Second, line, Fourth, line, Fifth, line. A word counter gives the same word and character numbers with sentences and paragraphs added.
Code files show why the empty-line rule matters. A 200-line file with 40 blank lines and 20 comment lines has 200 total lines but only 140 lines of real code, and a limit that says 200 lines of code means the non-empty count after comments are set aside. Pasting the file here gives both numbers at once, so you can answer either question without counting by hand.
Total lines vs non-empty lines — the count people get wrong
The most misunderstood number is the total. People paste a list, see 5 lines, and think they have 5 items — then they notice one line is blank and they really have 4. The total counts the blank line; the non-empty count does not. Always check which one your limit uses before you trust the number.
Blank lines creep in everywhere. Copying from a spreadsheet adds a blank line at the end. Copying from a chat app adds blank lines between messages. A file saved on Windows can end with a trailing line break, which adds one more empty line to the count. If your total looks one higher than you expect, the last line is probably empty.
The fix is to look at both numbers together. If total and non-empty differ by 1, you have one blank line — usually at the end. If they differ by 10, your text has gaps all through it. A text formatter can strip the blank lines out, and then the two numbers agree. A case converter can tidy the capitalisation of the same text once you are happy with its length.
A worked example: counting a short list
Here is a real situation where a line counter earns its keep. You have a list of names for a draw, and the organiser says the list must have exactly 50 names. Paste it in and the counter tells you exactly where you stand — no guessing, no manual counting.
Take the default text as a small example. It reads: First line, Second line, a blank line, Fourth line, Fifth line. The counter says 5 total lines, 4 non-empty lines, 46 characters, and 8 words. If this were a 5-item list, one item is missing — the blank line is not an item. If it were a 4-item list, the count is right.
Try a bigger one. A file with 1,000 lines and 50 blank lines has 950 non-empty lines. A poem of 14 lines with no blanks has 14 and 14. A log file where every second line is blank has half as many non-empty lines as total lines. Knowing both numbers lets you describe any text before you even paste it in, and a lorem ipsum generator can make test text of any length to check with.
Who uses a line counter, and why
Programmers are the biggest users. Code files, log files, and data files are all measured in lines, and a counter is the only way to check them honestly. A programmer who counts by hand wastes an hour and still gets it wrong; a programmer who pastes the file in knows in a second.
Writers and poets are the second group. Poems have fixed line counts — a sonnet is 14 lines, a haiku is 3 — and a counter checks them without counting on fingers. Songwriters count verses the same way. A list maker counts items, because one item per line means lines and items are the same number.
Translators and data workers are the third group. A translator who charges per line needs the line count before quoting a price. A data worker checking a CSV file needs to know it has exactly the right number of rows. The counter on this page handles all three uses — paste, check, edit, check again — which covers most of what anyone needs.
Line counter vs word counter
A line counter measures lines; a word counter measures words. The same text-tools family on this site does both jobs. A word counter counts words, characters, sentences, and paragraphs — and it counts lines too, in the sense that paragraphs are groups of lines. This counter adds the split the word counter does not have: total lines against non-empty lines.
The difference matters for workflow. Count lines first when the limit is per line, and count words first when the limit is per word. A poem limit is lines; an essay limit is words. If your limit is lines and you count words, you will be wrong by a factor of ten. If your limit is words and you count lines, you will be wrong the other way.
Character counters are the close cousin — some tools count characters only, with no line numbers. This counter includes characters, so it covers that job too. And a lorem ipsum generator makes filler text of any length to test a layout with, and this counter tells you exactly how many lines that filler holds.
Common line-counting mistakes
The most common mistake is counting the blank lines as items. A 50-name list with 2 blank lines is 48 names, not 50. Read the non-empty count, not the total, when the question is how many items you have. The total is for the file; the non-empty count is for the list.
Second: forgetting the trailing line break. Many editors add a line break at the end of a file, which adds one empty line to the total. A file you think has 100 lines reads as 101. If your total looks one higher than you expect, the last line is empty — check the non-empty count, which will read 100.
Third: counting lines in a wrapped paragraph. A long sentence that wraps onto three lines on your screen is still one line to this counter, because wrapping is not a line break. Only the Enter key makes a line. If your text wraps, the screen lies and the counter tells the truth.
Fourth: mixing up lines and paragraphs. A paragraph is a block of lines separated by blank lines; a line is a single row. A document with 10 paragraphs can have 40 lines. Count the thing your limit names, and use the matching number on this page.
How to use this line counter
Using this line counter is simple. Paste your text into the box, or type it directly. Every number updates live as you type — total lines, non-empty lines, characters, and words. There is no button to press and no form to submit.
To check a different text, select all, delete, and paste the new one. The counts reset instantly. If your text has several paragraphs, separate them with blank lines and watch the gap between total and non-empty lines grow — that gap is your blank-line count.
Everything runs in your browser. No sign-up, no account, no data sent anywhere — your text never leaves your device. It works offline once the page has loaded, so you can use it on a plane, in a classroom with no signal, or anywhere else you count lines. Try it with something real before you need it: paste your last list or log file, and see the numbers. To join those lines into one block of text, use the line break remover.