The file that was one line off
The subtitle file loaded fine but displayed wrong: one cue ran three lines deep and pushed the text off the bottom of the frame. The poem that should have been a sonnet turned out to have fifteen lines after a paste silently merged two. The CSV export should have held a thousand rows and held 999. In each case the file was one line off, and the only way to know before playback, publication, or import was to count.
The line counter above reports total lines, non-empty lines, and per-line word counts as you type or paste. It runs entirely in your browser and uploads nothing, so client subtitle files and unreleased data exports stay on your machine.
Logical lines versus visual lines
This is the distinction that trips up almost everyone, so here it is up front. This tool counts logical lines: stretches of text terminated by a newline character. Your text editor also shows you visual lines, which are what soft word wrap produces when a long logical line spills across a narrow window.
Those two numbers can differ wildly. A 200-character subtitle cue wrapped in a narrow editor displays as three visual lines while remaining one logical line in the file. Resize the window, change the font, toggle wrap: the visual count changes constantly and the logical count never moves. If your editor's gutter said 700 and this tool says 500, the difference is wrapping, not lost text.
Two more honest details. A final line without a trailing newline still counts as a line here, which is what humans expect. The classic Unix tool wc -l instead counts newline characters, so the same file reports one fewer there when it lacks a final newline. Neither is wrong; they answer slightly different questions, which is why counts across tools occasionally disagree by exactly one.
How counting works under the hood
The text is split on newline characters. Windows files use a carriage return plus a newline (\r\n); macOS and Linux use a bare newline (\n); ancient Mac files used a bare carriage return. All three are treated as one line boundary here, and stray carriage returns are not counted as content.
A line is empty when nothing sits between two boundaries. For the non-empty figure, lines containing only spaces or tabs generally count as empty in tools like this one, which is what you want for prose and data checks, but not what you want if you are auditing trailing-whitespace issues. Markdown, for one, gives two trailing spaces at the end of a line a real meaning: a forced line break. If that distinction matters to your file, do not rely on the non-empty figure alone.
Who counts lines, and why
Subtitle authors. An SRT file stacks cues in a strict shape: an index number, a timecode line in the form 00:00:12,500 --> 00:00:16,000 (note the comma before the milliseconds), one or two lines of caption text, then a blank line before the next cue. Because the shape is fixed, the line count is a checksum. Commonly cited captioning conventions cap caption lines somewhere around 32 to 42 characters and two lines per cue; broadcasters and streaming platforms publish their own specs, so verify against the one that applies to your deliverable.
Poets and lyricists. Fixed forms are line counts first: a haiku is three lines, a sonnet fourteen, a villanelle nineteen. Free verse has no required count, but line breaks are its primary rhythmic instrument, and pasting between documents is the classic way two lines accidentally become one.
Programmers and reviewers. Line counts are a rough size and complexity proxy. A config file that grew from 200 lines to 2,000 between releases is a review flag before anyone reads a word of the diff.
Data wranglers. A CSV export should hold one header line plus one line per record. Counting lines after export catches dropped rows, duplicated rows, and trailing junk. One honest caveat: CSV fields may legally contain newlines inside quoted text, so in such files a line is not always a row, and the count will exceed or mismatch the record count for reasons that are not errors.
| Context | What a line means | What a wrong count tells you |
|---|---|---|
| SRT subtitles | Index, timecode, caption, separator | A malformed cue, a missing blank line |
| CSV export | Header plus one per record (unless quoted newlines) | Dropped, duplicated, or split rows |
| Fixed-form poem | The form itself | A paste merged or split a line |
| Code or config file | Rough size proxy | Unexpected growth, trailing junk |
| Plain-text log | One event per line | Truncated file, missing final newline |
Practical examples
Printing constraints. Report generators and legacy systems still think in fixed lines per page; classic continuous-feed line printers were built around 66 lines per page, and the setting survives in reporting tools today. If a generated report must paginate cleanly, count the lines a section produces before blaming the template.
Verse that survived a paste badly. A sonnet arrives as twelve lines. Either two pairs merged when a source hard-wrapped text was flattened, or the pasting editor swallowed the breaks at the octave's turn. Count first, repair second, and compare against the manuscript rather than the screen.
Email written in plain text. The convention for plain-text email is to hard-wrap at roughly 72 to 80 characters so the message survives any client. Counting lines after wrapping confirms every line landed, and per-line word counts flag any that wrapped oddly long.
Tips
Count the file, not the view. Turn off word wrap in your editor, or paste raw text here, before comparing any numbers.
Decide your trailing-newline convention and keep it. A file ending with one blank line inflates most counters by one, and inconsistent conventions make two versions of the same file compare unequal.
Use the empty versus non-empty pair as a density measure. Prose pasted with paragraph spacing carries many empty lines; a data file should carry few. Either number out of expectation points at a formatting problem before you read a single line.
Scan per-line word counts for outliers. A 40-word line in a subtitle file is a cue begging to be split; a 200-word line in supposedly wrapped text means the wrap never happened.
Common mistakes
Comparing against wc -l and panicking over one. That tool counts newline characters; a file without a final trailing newline reports one fewer there. Same file, both correct.
Counting wrapped display lines. Your editor's gutter and a PDF's rendered page both show visual lines. Neither reflects the file.
Assuming one line equals one record in CSV. True only while no quoted field contains a newline. Check the format before trusting the arithmetic.
Ignoring carriage-return artifacts. Files edited across platforms can retain stray \r characters. A counter of this kind treats a lone \r as a line break, so it adds a spurious empty line and makes the total disagree with what you see in an editor, rather than making an empty line look non-empty. Clean before you count, and count again after.
Limitations, stated plainly
The counter has no notion of what a line means. A timecode line counts exactly like a line of dialogue, and format rules, cue lengths, field counts, meter, all live outside its view. The count reflects what you paste, not what sits on disk: copying from an editor may add or drop the final newline on the way through the clipboard. Quoted newlines in CSV, hard-wrapped email text, and rich-text pastes that lose structure entirely will all produce counts that describe the paste faithfully and the intent badly. For per-line width discipline in subtitles and social copy, pair this with the character counter; for prose rhythm, where lines and sentences rarely coincide, the sentence counter is the right tool.
Frequently Asked Questions
Does this line counter upload my text?
No. Counting happens entirely in your browser with JavaScript and nothing leaves your device, which keeps client subtitle files, exports, and unpublished work private.
What is the difference between a line and a sentence?
A line ends at a newline character; a sentence ends at terminal punctuation. In prose the two rarely coincide, since paragraphs reflow across lines depending on the medium. Count lines for files and formats, sentences for rhythm.
Why does my count differ from wc -l?
wc -l counts newline characters, so a file whose last line lacks a trailing newline reports one fewer than the number of lines you see. Mixed \r\n and \n endings can cause further disagreements in other tools. Both counts are defensible; they measure slightly different things.
Do blank lines count?
Yes, in the total. The non-empty figure excludes lines with no content, and usually lines holding only spaces or tabs. Use the pair together: the gap between them is your file's blank-line budget.
How many lines is one SRT cue?
Typically three or four: index, timecode, and one or two caption lines, followed by a blank separator before the next cue. Caption width conventions commonly cited run about 32 to 42 characters per line, but always verify against the spec your deliverable names.
Can I use this to check a poem's line count?
Yes. Paste the poem as plain text and confirm the count matches the form, fourteen for a sonnet, three for a haiku. Watch for soft wrapping in the source document merging two verse lines into one during the copy.
Count once, trust the file
Adopt one habit: every line-oriented file gets a ten-second count before it ships. Subtitles, exports, verse, logs. Structure errors are far cheaper to catch by arithmetic than by playback, and the arithmetic takes less time than loading the file anywhere.