TechCompare LogoTechCompare

Count lines and blank lines in plain text

Lines count actual line breaks. Nonempty lines count only lines with content beyond whitespace.

A line counter measures lines in the text itself, rather than rows produced by the width of your screen. In the Character Counter, each line break starts another line. Empty lines are included, and a line break at the end starts a final empty line. The breakdown also shows nonempty lines, which helps you check lists or pasted text where blank spacing shouldn't count as a content entry.

By TechCompare · Updated

Example characters
38
Visible characters, including whitespace
Example words
6
Counting topic
Line counter

Calculator

Character Counter

Example text

First entry Second entry Fourth line

Characters
38
Words
6
Sentences
3
Paragraphs
2
Lines
5
No whitespace
31

How this is calculated

A long sentence can wrap across several visible rows in the editor and still occupy one actual line. Resize the browser and those visible rows change, while the line count stays the same. Press Enter and the count increases because the text now contains a line break. Windows line endings use a carriage return and a line feed together. This tool normalizes that pair to one line break, and it handles a standalone carriage return the same way. A completely empty input has zero lines here. Once there is text, a final newline creates an empty last line, which explains a common one-line difference between counting tools.

Verdict

Choose the total that matches the question you're asking. Use Lines for the structure of a text file, including its blank spacing. Use Nonempty lines when you're checking a list that may contain empty rows. A wrapped paragraph isn't a list of separate lines, and a line can contain more than one item if they're separated by commas or other characters. The count won't decide whether those entries are valid. If you're preparing data for another program, inspect its expected format and final newline behavior before treating the count as a record total.

More Counting scenarios

Frequently asked questions

Does the character count include spaces?
Yes, the main count includes spaces, tabs, and line breaks by default. The No whitespace card excludes all of them. Open Counting options to change the main count. Windows and classic Mac line endings are normalized to one line break.
Can I count only certain characters or words?
Yes. In Count only, type characters together or enter one word or phrase per line. You can match case and choose whole words or substring matches. Duplicate targets are counted once. Matches don't overlap within one target, but separate targets can match the same text.
What's the difference between a line and a paragraph?
A line ends at a line break. Empty lines and a final line break count toward the line total. A paragraph is a nonempty block separated from the next block by a blank line. Visual wrapping in the editor doesn't add lines or paragraphs.
How are emoji, words, and sentences counted?
Visible character mode groups a complete emoji or an accented letter as one character when your browser supports it. Code point mode counts the underlying Unicode code points. Word and sentence boundaries use browser text segmentation with an English locale. Abbreviations and languages can affect counts. Older browsers use simpler fallback rules. See Unicode text segmentation for the underlying boundary concepts.
Is my text uploaded or saved?
Counting runs in your browser. This tool doesn't upload or save your text and doesn't put it or your custom search terms in the URL. Share links open an empty counter. Copy text or counts if you want to keep them before closing or reloading the tab.
Can I count just part of my text?
Select text in the editor, then choose Selected text. The counts, custom matches, writing limit, breakdown, and word frequency panel all use that selection. Choose Full text to return to the entire document.