Line Counter Tool

Paste text to count its lines, words and characters.

Result

4
3
9
46
37

How it is calculated

The text is first normalised so that Windows (\r\n) and old Mac (\r) line endings count as one break each. Lines = number of pieces after splitting on line breaks, so a blank line counts and so does a trailing newline at the end (it creates one extra, empty last line). Non-empty lines skips lines that are blank or contain only spaces or tabs. Words are runs of characters separated by any whitespace. Characters counts Unicode characters, not bytes, with line breaks included; the no-spaces figure removes every whitespace character, including line breaks. An empty box gives no result.

Worked example

The text is three lines of verse with one blank line between the first two: Roses are red, an empty line, Violets are blue, Sugar is sweet. Splitting on line breaks gives 4 lines, and one of them is blank, so 3 are non-empty. The words are 3 + 3 + 3 = 9. The characters are 13 + 16 + 14 letters and spaces plus 3 line breaks, which is 46 including spaces. Removing 6 spaces and 3 line breaks leaves 37 characters without spaces.

Try this example →

Common mistakes

  • Pasting text that ends with a newline and expecting the line count to match what you see: the final line break adds one empty line to the total, while the non-empty count is unaffected.
  • Comparing the characters figure with a limit that is stated without spaces (or the other way round); the two figures differ by every space and line break.
  • Treating the line count as a paragraph count. A paragraph separated by a blank line counts as at least two lines here, so use the non-empty figure, and even that counts each wrapped sentence on its own line.
  • Expecting hyphenated or slashed items such as well-known or and/or to be split: only whitespace separates words.

About this calculator

The tool scans pasted text and reports five counts: total lines (split on line breaks), non-empty lines (excluding blank ones), words (split on whitespace), characters, and characters without spaces, giving an instant breakdown without opening a word processor or spreadsheet.

Writers checking a submission's length against a publication's limits, programmers gauging a file or log's size, students hitting a word-count requirement, and editors verifying a document's structure all use quick line and word counts like this rather than relying on a full-featured text editor just to check a number.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    Because each line break ends a line, the tool doubles as an item counter. Paste a list with one entry per line and read the non-empty line figure to see how many entries there are, ignoring blank gaps. Text that merely wraps on screen is still one line, so a long paragraph counts as one. What do you most often count with it, lists, code or subtitles?

Popular calculators

All Calculators