How Paragraphs Are Counted, and Why a Blank Line Matters
Counting paragraphs sounds simple until a text has single line breaks, blank lines that are not empty, or invisible characters. Here is the rule our two counters use, tested on 18 inputs.
Short answer: ClearText Editor and Clear Count count a paragraph as a block of text separated from the next one by at least one blank line. A single line break does not start a new paragraph, extra blank lines count only once, and a line holding only spaces, a tab or a non-breaking space counts as blank. In our tests of 18 texts the two tools gave the same number every time.
The Rule
Both tools do the same three things. They trim the text, split it wherever a line break is followed by an empty (or whitespace-only) line and another line break, and ignore any empty pieces. Empty text, or text with only spaces, counts as 0 paragraphs. The two versions of the code differ by one character in the pattern, and that difference changes no result.
The rule is a choice, not a law. A text editor that treats every line break as a paragraph would give a different total for the same text, and we did not test other tools on these inputs. If a number looks wrong, first look at how your text separates its lines.
What We Tested
We typed 18 short texts into the live tools in a headless Chrome browser and read the paragraph figure each one showed. The tools also agreed on word counts for every text that we compared.
| Text | Paragraphs |
|---|---|
| One line | 1 |
| Three lines with single line breaks, no blank line | 1 |
| Three paragraphs separated by one blank line | 3 |
| Two paragraphs with three blank lines between them | 2 |
| A blank line that contains one space | 2 (counted as blank) |
| A blank line that contains a tab | 2 (counted as blank) |
| A blank line that contains a non-breaking space | 2 (counted as blank) |
| Windows (CRLF) line endings | 3 for three paragraphs |
| Blank lines at the start or at the end | Ignored (2 for two paragraphs) |
| Only spaces, or nothing at all | 0 |
| A heading, a two-item list and a closing sentence, each separated by blank lines | 3 |
| Five paragraphs of three sentences each | 5 |
A text pasted into the box gave the same count as the same text typed in. We tested that by inserting text into the box the way a paste does, not with a real clipboard, which a headless browser does not have.
Where the Count Is Not What You Might Expect
- Line breaks inside a block do not split it. A letter or an email with a line break after every line and no blank lines is one paragraph. The same goes for text copied from a PDF, where lines are often broken at the edge of the page. Our guide to removing line breaks from copied text covers that case.
- A separator such as * * * counts as its own block. Three blocks separated by blank lines, one of them a scene break, gave 3. Someone counting only prose paragraphs would say 2.
- The Unicode paragraph separator (U+2029) does not split paragraphs. The tools only look for ordinary line breaks, so two paragraphs divided by that character count as 1. The line separator (U+2028) is read as whitespace, so the words are counted correctly.
- A zero-width space on its own line does not make it blank. The line looks empty, but the tools do not treat that character as whitespace. In our test, the two paragraphs separated by such a line counted as 1, and the invisible character was counted as an extra word (5 instead of 4).
The last two cases are rare in ordinary writing. They appear mostly in text produced by other software, which is also where invisible characters hide, as we describe in zero-width characters and hidden text.
Why Line Endings Make No Difference
We tried Windows line endings (CRLF) and a lone carriage return, the old Mac line ending. Both gave the expected counts. That result comes from the browser: a text box converts both kinds of line ending to a plain line break as soon as text goes in, so the counting code never sees them.
How to Get the Count You Expect
- Put one empty line between paragraphs. That is all the rule needs.
- If your text has a line break after every line and the count is 1, add blank lines between the real paragraphs, or join the broken lines first.
- If a line that looks blank does not split two paragraphs, it probably holds an invisible character. Delete the line and press Enter again.
- Use the same tool when you compare two drafts, because another counter may follow another rule.
The same caution applies to sentences and words. See how sentences are counted and why tools disagree and why word count never matches between tools. For what Microsoft Word shows, read our post on word count in Microsoft Word. You can try the rule in ClearText Editor or Clear Count.
Paragraph counting is the simplest of the three counts, and our two tools agree on every case we tried. The only places it can surprise you are invisible characters and texts where line breaks stand in for paragraphs.
Related posts
For questions or inquiries contact us at info@cleartexteditor.com