Free line counter for lists and pasted text
Line counter that separates the blank ones
TextLab's line counter gives four numbers a glance never gets right: every line, the lines with something on them, the blank ones, and the ones that only look blank because they hold a stray space. It is free, there is nothing to sign up for, and a hundred thousand lines go through without complaint. It also names the longest and shortest lines, lists everything over a width you set — 42 for a subtitle, 72 for an email — and reads which style of line ending your text arrived with.
- 100% free
- No signup
- Blank lines counted apart
- Width check
- Windows and Mac line endings
Where the line breaks came from
Paste something in and this line will name the invisible characters that ended each line: the Windows pair, the single character Mac and Linux use, or a mixture of both. Text typed straight into the box always uses the single character, because the box converts as you type.
Lines longer than 80 characters
Set the width your format needs — 42 for a subtitle, 72 for a plain-text email, 80 for a terminal — and every line that overshoots it is listed here.
The ten longest lines
The longest lines in a pasted block are almost never the ones you would guess, which is why they get their own list.
How to count lines
Three steps, and the counts move while you are still scrolling the paste.
Paste the list or the block of text
Drop in a list of names, a column from a spreadsheet, a subtitle file, an address block or a chapter — and a ⌘V, or Ctrl+V on Windows, is picked up by the whole page rather than the box alone. Pasting matters for one extra reason: it is the only moment the original line endings are visible, so that is when they are read.
Read the four counts, blank lines kept apart
Lines is every line including the empty ones; lines with text ignores the gaps; blank lines counts them; and “only spaces on them” picks out the lines that look empty but are not. That last figure is the one that explains why a list of 240 entries insists it has 253 lines.
Set the width your format needs and read the overshoot list
Type a number into Line width or pick a common one — 42 for a subtitle, 65 for a comfortable reading column, 72 for a plain-text email, 80 for a terminal. Every line longer than that is listed with its line number, its exact length and its opening words, and a separate panel always shows the ten longest lines whatever width you chose.
Technical specifications
| What it reports | Total lines, lines with text, blank lines split into empty and space-only, the longest and shortest line with their numbers, the average length, and every line over a width you set |
|---|---|
| What counts as a line | The text between two line breaks, plus whatever follows the last one — line breaks plus one. An empty box is 0 lines; a single word with no break is 1 |
| What counts as blank | A line holding nothing but spaces and tabs. Truly empty lines and lines carrying invisible spaces are counted apart, because only one of the two disappears when you delete by eye |
| Line endings detected | The Windows pair, the single character used by Mac, Linux and the web, the carriage return alone that Macs used before 2001, and any mixture of them — read from the clipboard as you paste, because a text box converts them all as it accepts text |
| Common widths offered | 42 for a subtitle line, 65 for a comfortable reading column, 72 for a plain-text email, 80 for a terminal, 100 for a wide printed line, or any number from 10 to 500 |
| Extra checks | Lines ending in a space or tab you cannot see, the ten longest lines whatever width is set, and up to 120 over-long lines listed with their numbers and lengths |
| Length limit and speed | No cap. A 2,000-line list is measured in 0.07 ms and a 100,000-line file in 8.1 ms, timed on an Apple M2 Pro; only the ten longest lines are kept in memory, so the size of the paste does not matter |
| Price | Free, no account needed, no upload, and no ceiling on the number of lines |
Frequently asked questions
Does the last line count if there is no line break after it?
Yes. A line here is the text between two line breaks, plus whatever follows the final one, so three names typed on three lines count as three whether or not you pressed Enter after the last. The arithmetic is simply the number of line breaks plus one. This is where a text editor can disagree with you: a file that ends with a line break has one empty line at the bottom, which some editors show as a real line and some hide.
Why does my text editor report a different number of lines?
Almost certainly word wrap — your editor is counting the rows it drew on screen, not the lines in the text. A single 300-character paragraph with no line break in it fills four rows in a narrow window and two in a wide one, and the count changes when you resize the window. This page counts only real line breaks, the ones you made by pressing Enter, so the figure stays the same however the text is displayed. If your editor has a “soft wrap” or “word wrap” setting, turning it off makes the two numbers agree.
Are blank lines included in the total?
They are counted in the total and again on their own, because both numbers get asked for. A list of 40 entries double-spaced is 79 lines and 40 lines at the same time, and which one you want depends on whether you are checking a format or counting the entries. The blank figure is split further into truly empty lines and lines that hold only spaces or tabs — a distinction that looks pedantic until a mail merge treats a space-only line as real data.
What are line endings from Windows, and why do they matter?
They are the invisible characters at the end of each line, and Windows writes two of them where Mac and Linux write one. Nothing about your text changes, but programs that expect the other style react badly: a file can open with every line run into a single paragraph, or with a stray character showing at the end of each line, or with the whole thing double-spaced. Mixed endings inside one file — usually the result of two people editing it on different machines — are the version most likely to break an import.
Why does the page only detect line endings when I paste?
Because a text box on a web page rewrites them the instant it accepts text. Every browser normalises what is typed or pasted into a box to the single-character form before your text is ever readable, which means the box can never tell you what the original file used. The clipboard still holds the untouched version at the moment of the paste, so that is where the reading is taken. Type instead of pasting and the panel will honestly report nothing rather than guess.
How long should a line be?
It depends entirely on where the text is going, which is why the width is yours to set. Subtitles are usually capped at 42 characters a line so they can be read in the two seconds they are on screen; plain-text email has been wrapped at 72 for decades so that quoting does not push it past 80; terminals and many code reviews use 80; and typographers put the comfortable reading measure at 45 to 75 characters, which is why a book page is narrower than your monitor. Set the number your format requires and the list underneath names every line that breaks it.
How do I count only the lines that have something on them?
That figure is already there — “lines with text” ignores every blank and space-only line. It is the number you want when you are counting stanzas of a poem, entries in a list or rows destined for a spreadsheet, because the gaps you added for legibility should not inflate the count. If you would rather remove the gaps than count around them, the remove empty lines tool deletes both kinds, including the ones that only look blank.
A line is not the same thing as a row on your screen
Two people counting the lines in the same text routinely disagree, and the reason is that the word means two different things. One is the row you can see: the text your screen happened to fit before running out of room. The other is the line in the text itself, which exists only where somebody pressed Enter. Narrow the window and the rows multiply while the lines stay exactly as they were. Word processors add a third reading, counting lines per printed page for a manuscript, so the same document is 41 lines in one program and 3 in another and both are right about their own question. This page counts the second kind — real line breaks, whatever your screen is doing — because that is the number a spreadsheet, a subtitle file, a mail merge or a print shop will agree with.
Then there is the small mess left over from typewriters. Ending a line on one meant two movements: return the carriage to the left margin, and roll the paper up one line. Early computers copied both, and Windows still writes both characters at the end of every line, while Mac, Linux and the web write only the second. Nothing about the words changes, but a file written in one style and read by a program expecting the other goes wrong in three recognisable ways: everything runs together into one enormous line, or a stray mark appears at the end of every line, or the whole document turns double-spaced. Mixed endings — the fingerprint of two people editing one file on different machines — cause the worst of it. This page names which style your text arrived with, and it can only do that at the instant you paste, because every text box on the web silently converts line endings as it accepts them.
The width check exists because the line is the unit that formats care about. Subtitles are held to about 42 characters a line so a viewer can read them in the couple of seconds they are on screen; plain-text email has wrapped at 72 for forty years so that two rounds of quoting still fit inside 80; terminals and printed code stop at 80; and typographers have long put the comfortable reading measure at 45 to 75 characters, which is why the column you are reading now is narrower than your monitor. Set the number your format needs and every line that breaks it is listed with its position, so fixing them is a matter of going down the list. When the fix is deletion rather than rewriting, the remove empty lines tool clears the gaps and the space-only lines together, and when a paste has arrived chopped into short lines by a PDF, the remove line breaks tool puts the paragraphs back together before you count anything.
The list you paste is not going anywhere
Every line is measured by JavaScript inside this tab, which is why a customer list, a set of email addresses or an unreleased subtitle file is safe to drop in: there is no upload, no server call and no log. The line endings are read straight from the clipboard event in your own browser and thrown away with everything else the moment you press Clear or close the tab.