Compare line counts of two texts

Compare line counts produces a small table summarising both texts on three axes: lines, words, and characters. Paste both into the input pane separated by a line of ---; the tool counts each side independently and prints a Metric, A, B, diff table. The counts run in your browser; nothing uploads. For per-line content changes use diff.

Input
Line 1:1 LF cloud_done Saved locally
Result Compare Line Counts
0 lines 0 chars

Three numbers per side, plus a delta

The count comparison gives a structural overview rather than a content diff. The split between text A and text B is a line containing exactly ---. For each side the tool computes three numbers: line count (split on \r?\n), word count (regex \S+, so any non-whitespace run is a word), and character count (the raw .length).

Output is a tab-separated table. Header row is Metric  A  B  diff; each metric row shows A's count, B's count, and the signed difference B - A. A positive diff means B is larger; a negative diff means A is larger. Paste the result into a spreadsheet to keep the columns aligned.

Empty input on either side counts as zero lines, zero words, and zero characters. Word count uses non-whitespace runs, so punctuation attached to a word counts as part of that single token. For the actual content of the changed lines, use diff or find additions.

How to use compare line counts of two texts

  1. 1Paste text A into the input panel, then a line with ---, then paste text B.
  2. 2The four-row count table appears in the output panel: header plus Lines, Words, Chars.
  3. 3Click Copy to copy the table; the columns are tab-separated, ready for a spreadsheet.
  4. 4Read the diff column for the signed change B - A on each metric.
  5. 5For per-line content differences pivot to diff.

Keyboard shortcuts

Drive TextResult without touching the mouse.

Shortcut Action
Ctrl FOpen the find & replace panel inside the input Plus
Ctrl ZUndo the last input change
Ctrl Shift ZRedo
Ctrl Shift EnterToggle fullscreen focus on the editor Plus
EscClose find & replace, or exit fullscreen
Ctrl KOpen the command palette to jump to any tool Plus
Ctrl SSave current workflow draft Plus
Ctrl PRun a saved workflow Plus

How the counts are computed

Lines via \r?\n

Each side is split on \r?\n. Empty input counts as zero lines; otherwise the count is the number of segments produced by the split. CRLF and LF line endings both yield the same number.

Words via non-whitespace runs

Words are matched with the regex \S+, so anything between whitespace boundaries counts as one word. don't is a single word, and foo,bar is also a single word because there is no whitespace between the two halves.

Characters via raw length

Character count is the raw JavaScript .length, which is UTF-16 code units. Most Latin characters count as one each; emoji and astral codepoints count as two.

Signed diff column

The diff column shows B - A per row. Positive means B has more; negative means A has more; zero means matched.

Three-hyphen separator

The split between A and B is a line containing exactly ---. Without it the tool returns a prompt asking for two halves.

Worked example

Text B has one more line, one more word, and eight more characters than text A. To see what changed, switch to diff or find additions.

Input
alpha
bravo
---
alpha
bravo
charlie
Output
Metric	A	B	diff
Lines	2	3	1
Words	2	3	1
Chars	11	19	8

Settings reference

Behaviour Effect on output
Separator A line containing exactly --- splits text A from text B.
Line counter Splits on \r?\n; empty input is zero lines.
Word counter Counts \S+ matches; whitespace is the only delimiter.
Char counter Raw JavaScript .length (UTF-16 code units).
Diff column Signed value B - A per metric.
Output format Tab-separated, four rows including the header.
Empty side Counts as zero on every metric.

FAQ

Does the word counter use Unicode word boundaries?
No. It counts runs of non-whitespace, so punctuation attached to a word is part of that word and CJK without spaces will register as one large word. For Unicode word splitting use word set intersection, which uses \b\w+\b.
Why does my emoji count as two characters?
JavaScript strings are UTF-16. Emoji in the astral plane occupy two code units, so they contribute 2 to the character count. This matches the behaviour of "๐Ÿ˜€".length.
Is the trailing newline counted as a line?
A trailing newline produces an extra empty segment when split, which is counted as a line. Trim trailing whitespace if you want pure content lines.
How do I see which lines actually changed?
Pipe the same two halves into diff for a position-based view, or find additions for set-based new entries.
Can I copy the table into a spreadsheet?
Yes. Columns are tab-separated, so a paste into Excel, Google Sheets, or Numbers splits cleanly into four columns.