Text ToolsA little help for every day

Search by name or task, such as JSON or percentage.

Text Tools

Online Line Counter

Count total, non-empty, blank and repeated lines, find the longest line and flag lines over a length limit, with average length, words, characters and bytes.

View all tools
ResultUpdates as you type
Lines6
Non-empty lines4
Blank lines (incl. spaces only)2
Distinct non-empty lines3
Repeated lines1
Longest line45 chars (line 5)
Average non-empty line15.5 chars
Words12
Characters71
UTF-8 bytes71

The text ends with a line break; the empty line after it is not counted.

How to use Online Line Counter

Paste text on the left and the counts update as you type. By default a final line break does not add a line, as with wc -l. To check code, CSV or subtitles for width, enter a character limit and the result lists the line numbers that exceed it.

  1. Paste your textPaste a list, a log, source code, a CSV export or subtitles; every line break starts a new line.
  2. Set the rulesDecide whether a final line break adds a line, and enter a length limit such as 80 if you need one.
  3. Read the resultsSee total, blank and repeated lines, the longest line and the line numbers of any over-long lines.

Total, blank and repeated lines

Blank lines are lines that are empty or contain only spaces; non-empty lines contain at least one visible character. A repeated line is a non-empty line that matches an earlier one, ignoring spaces at either end. In the sample, 6 lines include 4 non-empty and 2 blank ones, banana appears twice so there is 1 repeated line, and the longest is line 5 at 45 characters. The average length of the non-empty lines, 15.5 characters here, shows how even the data is.

Final line breaks and line length

Most editors end a saved file with a line break. By default the empty line after it is not counted, which matches wc -l and the line count on GitHub; untick the option to count what the text box shows. Line length counts characters as you see them, so an accented letter or an emoji counts once. Set a limit to find code lines or records longer than 80 or 120 characters before a linter or an import complains.

Accuracy and data handling

Before copying the output, check names, punctuation and the intended meaning against the source text. The calculation runs in your current browser; the tool code does not send the input to a processing API.

Often Used Together

Next step

FAQ

Does a trailing line break add a line?

Not by default, matching wc -l. Untick Don't count the empty line after a final line break and that empty line is added to the total and blank counts.

Why can the byte count be higher than the character count?

UTF-8 stores many characters in more than one byte: accented letters take two bytes and Chinese characters three, so text with them has more bytes than characters.

Is my text uploaded?

No. Every count is worked out in your browser, and nothing you paste is sent to a server or stored.

More Text Tools

Related tools