Free Online Line Counter Tool

Paste or type your text below and see the line count update live. Along with total lines, you also get empty lines, non-empty lines, words, sentences, characters, and paragraphs — all running locally in your browser with no signup and nothing uploaded.

Your text

Paste or type — stats update live
Tip: Every line break creates a new line. If your text ends with a trailing line break, the final empty line is not counted — matching how most code editors and text tools behave.

Statistics

Live statistics
Total Lines
0
Non-empty Lines
0
Empty Lines
0
Characters
0
Detailed stats
Words 0
Sentences 0
Paragraphs 0
Characters (without spaces) 0
Average line length 0 chars
Longest line 0 chars
Shortest non-empty line 0 chars

How to use the line counter

Three steps, that's it. Paste or type into the box on the left. Watch the numbers move. Copy what you need.

If you've ever stared at a file wondering how many lines it has, this is the fastest answer you'll get. It doesn't matter whether the text came from VS Code, Notepad, a spreadsheet export, a chat message, or a PDF you copied out of. If it's text, it counts.

Not sure what to try first? Hit Load example. It drops in a small block with blank lines, mixed line lengths, and a trailing newline — enough to show you how the counter handles the awkward cases before you trust it with real work.

What the line counter actually reports

The headline number is total lines. That's the count of every line ending in the text, blank or not.

Below that you get two more that most people find useful once they start looking: how many lines are actually empty, and how many have real content. The gap between those two is usually a surprise. A file that looks like it has 500 lines might only have 380 with content — the rest are spacing.

Then there are the cross-metrics: words, sentences, paragraphs, characters with and without spaces. And three structural numbers you won't find in most counters — average line length, longest line, and shortest non-empty line. Those three tell you a lot about the shape of a file. A code file with an average of 45 characters per line reads very differently from one averaging 110.

How lines are detected

A line is anything that ends in a line break. There are three ways computers write line breaks, and this tool handles all of them:

  • LF — the Unix and modern macOS standard. A single \n.
  • CRLF — what Windows uses. A \r\n pair.
  • CR — the classic Mac convention. A single \r, still found in some old files.

You can paste text that mixes all three and it will still count correctly.

Two edge cases worth mentioning. If your text ends with a trailing line break — which is to say, if you pressed Enter after the last line — the tool does not count that as an extra empty line. Every code editor on the planet does the same thing, and it would be weird if a line counter disagreed with them. Second, a line that contains only spaces or tabs counts as empty. Technically there are characters on it, but if you can't see anything, it's empty for counting purposes.

Why people count lines

Line count sounds like a niche metric until you need it. Then it's suddenly everywhere.

Programmers use it constantly. Not just for file size — for spotting when a function has crept past the length where it should have been split. If a single function is 200 lines, that's usually a signal, not a coincidence.

Log analysis is line-oriented work. Every server log, error log, and access log has one event per line. When you're trying to figure out how many requests hit your server in an hour, counting lines is the direct answer.

CSV files have one record per line. So do TSV files, and most line-delimited data formats. Line count gives you the record count without opening a spreadsheet.

Writers use it more than you'd expect. Poets keep line counts. Screenwriters count dialogue lines. Technical writers working on numbered specs care about line count because the numbering has to be right.

Translators often quote per line, especially in localization work where every string is on its own line in a resource file. Verifying the count up front avoids the awkwardness of discovering a mismatch after delivery.

And then there are the everyday moments. Someone sends you a config file and asks how long it is. Someone posts a comment thread and you want to know how many messages it has. Those aren't urgent, but they're the kind of thing you'd rather not count by hand.

Line count vs. word count vs. paragraph count

These numbers measure different units, and mixing them up causes confusion.

MetricWhat it measuresBest for
Line countEvery line ending in the textCode, logs, CSV, poetry, dialogue
Word countWhitespace-separated wordsEssays, blog posts, SEO, word limits
Paragraph countBlocks separated by blank linesEssay structure, formatting checks
Sentence countSentence-ending punctuation marksReadability, editing, grammar
Character countEvery character, including spacesTwitter/X, SMS, meta descriptions

Line count is about structure. It's about how the text is laid out vertically — where the breaks are, how many of them there are. It's the metric that matters for anything line-delimited.

Word count is about content volume. It's what editors and teachers and SEO tools care about. When someone says "keep it under 1,000 words," they mean words, not lines.

Paragraph count is about idea structure. How many blocks of thought are there? That's a very different question from how many lines. A dense paragraph of 40 lines and a short one of 2 lines each count as one paragraph.

The right metric depends entirely on what you're doing. Code review uses line count. Essay writing uses word count. Contract review probably uses paragraph count. Most of the time you'll want two or three at once, which is why this tool shows all of them.

Line Counter Online — Free and Instant

A line counter online should be the simplest thing on the internet. Paste, read, done. No account, no delay, no "uploading your file" spinner.

That's what this page is. You paste, you read the number. The whole interaction takes less time than opening a text editor. Because it's also a text counter online, you're not limited to just lines — words, characters, sentences, and paragraphs all update in the same box, in real time. If you're working with a text line counter or an online text line counter, you can figure out how many lines are in a paragraph, or how many words fit on a line, without switching tabs. As a text line analyzer, the tool also surfaces the shape of the file — longest line, average line length, and the ratio of blank to non-blank lines.

It works as a line counter for documents as easily as it works as a line counter for code. Paste a report or a source file; the counter doesn't care. Both are just text with line breaks, and this free online line counter tool counts the number of lines in either one in the same millisecond.

And it's free in the way that word should mean. No credit card, no trial period, no "free up to 5,000 lines." There's no limit at all, and there won't be.

Who uses a line counting tool

The short answer is: anyone who works with text files.

The slightly longer answer includes programmers checking function length, sysadmins counting log entries, translators verifying resource files, students formatting an assignment with a required line count, poets working with a fixed structure, teachers marking work where line limits matter, and anyone who's ever been asked "how many lines is this?"

There's also a small group of people who just like knowing. The line count of your favourite book, the number of lines in a song lyric sheet, the length of a film script — these are the kinds of numbers that are mildly interesting once and forgettable afterward. Which is exactly why a tool that answers the question in one second is useful.

How to count lines in a text

Three ways, ranked by how pleasant they are.

The slow way: open the file, look at the last line number in the gutter. Works fine for one file. Not so great when you're on a phone, or when the file is in a browser, or when you're pasting from somewhere.

The almost-right way: use your editor's status bar. VS Code, Sublime, Notepad++ — all of them show line count somewhere. But it's usually hidden, usually shows the current cursor position instead of total lines, and usually requires you to open the file first.

The fast way: paste it here. Any text, any source, instant answer. This is how to count lines online without opening anything. The first two work; the third is faster. That's the whole comparison.

Count lines in a text file, copied text, and code

A text file and copied text are the same thing as far as a line counter is concerned. The only difference is how it arrived in the box — dragged from your filesystem or pasted from a clipboard. The math doesn't change.

Code is a slightly different story. Source files are usually written with LF or CRLF endings depending on the OS. Some projects enforce one, some don't. Some editors quietly convert line endings on save. A file that looks consistent in your editor might not be consistent on disk.

This tool normalizes all three line-ending conventions before counting, so a mixed-endings file still gets an accurate number. That matters when you're trying to reconcile a "diff shows 50 lines changed" message with a line count that doesn't match.

For code specifically, the longest-line number is often more useful than the total. If your longest line is 240 characters, that's usually a readability problem — regardless of what your linter says.

Count blank lines, and count lines with words and characters

Blank lines are a metric people don't ask about until they need it. Then they really need it.

A 500-line file where 400 lines are blank is a very different file from a 500-line file where every line has content. The first one is mostly spacing; the second is dense text. Both are 500 lines, and both can be valid, but the structure of each is completely different.

The counter separates them for you. Empty lines and non-empty lines are shown as two separate numbers, plus the total. If you want to know how many blank lines are in a block of text — say, when checking the formatting of a Markdown document, or when preparing a file for a script that's sensitive to whitespace — that number is right there.

And when you need lines alongside words and characters, they're all in the same stats panel. This is a line counter with word count built in, plus character count, sentence count, and paragraph count. No switching tools, no re-pasting.

Frequently asked questions

A line counter is a tool that counts how many lines are in a block of text. It counts every line ending, whether the line has content or is blank. Along with the total line count, most counters also show related stats like empty lines, non-empty lines, word count, and character count.
The tool splits your text on every line break — LF, CRLF, or CR. Every line ending creates a new line. If your text ends with a line break, the trailing empty line is not counted unless there is content after it. This matches the convention used by most code editors and text tools.
Paste your text into the box at the top of this page. The total line count and every other stat updates the moment the paste happens. There is no button to press, no file to upload, and no sign-up required.
Yes. This page is a completely free online line counter with no account, no daily limit, and no premium tier. It's supported by optional donations and doesn't restrict how many lines you can count or how often you use it.
Total lines counts every line ending, including blank ones. Non-empty lines only counts lines that contain at least one non-whitespace character. The difference between the two numbers is the count of blank lines.
Paste your text into the counter. The empty lines tile shows exactly how many blank lines your text contains. A line that holds only spaces or tabs is counted as empty, because it has no visible content.
Yes. Open the file, select all, copy, and paste it into the box. Text files, log files, source code files, and CSV exports all paste cleanly. The counter handles all three common line-ending conventions — LF from Unix, CRLF from Windows, and CR from classic Mac — so mixed-endings files also count correctly.
A line counter measures every line ending in the text — each press of Enter creates a new line. A paragraph counter measures blocks of text separated by blank lines. A single paragraph can span many lines, so the two numbers are almost never the same. Code and log files care about line count; essays and articles usually care about paragraph count. If you need the paragraph number specifically, our Paragraph Counter handles that.
Yes. This is a line counter with word count built in, and character count as well. Every stat — lines, empty lines, non-empty lines, words, sentences, paragraphs, characters with and without spaces — appears in the same panel and updates together as you type.
Yes. As you type or paste text, the total line count, empty line count, non-empty line count, word count, and character count all update instantly. There is no button to press and no waiting — everything runs locally in your browser.
There is no artificial limit. You can paste whole source files, log dumps, or book chapters. Extremely large inputs may slow down your browser tab, but the tool itself does not impose a cap.
Yes. The tool is fully responsive and works on phones, tablets, laptops, and desktops. You can even add it to your home screen for quick access.
No. Everything runs locally in your browser using JavaScript. Your text never leaves your device, there is no server processing, and nothing is logged or stored.
Yes. Once the page has loaded, the line counter keeps working even without an internet connection because all processing is local.