Text comparison guides

Ignore whitespace in a text diff: what actually changes?

Ignoring leading and trailing whitespace only changes how the edges of each line are compared. It does not ignore spaces inside a sentence, remove blank lines or join paragraphs.

Compare your text

Input and output example

Original text
  alpha  
hello world
Revised text
alpha
hello  world
01

What the option ignores

When selected, comparison uses trim() on each line for equality checks. This covers whitespace recognized by JavaScript trim, including ordinary spaces and tabs at line boundaries. The displayed text keeps its original spacing: the option does not rewrite your input.

02

Internal spaces still matter

In the example below, the first line differs only in spaces around alpha. The second has one space between hello and world on the left and two on the right. Both lines differ by default. With the option enabled, the first line matches but the second still differs. Paste the example into the editors to reproduce it.

03

Line endings are not blank lines

CRLF, CR and LF are normalized to LF before comparison. Identical text with different Windows or Unix line endings therefore matches. However, alpha and alpha followed by a final newline still differ: the latter contains an additional empty line. Ignoring whitespace does not remove that line.

04

Ignore for review, clean to change the text

Use the comparison option when you only want to review content. Use the whitespace cleaner to produce edited output. Its leading and trailing cleanup removes ordinary spaces and tabs only, a narrower set than trim(), so the two operations are not interchangeable.

05

Keep indentation visible in code

Indentation can carry meaning in Python, YAML and Markdown. Leave whitespace differences visible when reviewing these formats, then validate with the relevant parser or tests. A text diff is not a syntax checker and cannot determine whether an indentation change is safe.