Compare Text Online While Ignoring Formatting Differences

Learn what ignoring formatting means in a text comparison, which differences to ignore for your situation, and how to keep results readable and your text safe.

Two versions of a document can look nearly the same and still produce a comparison full of red and green. Stray spaces, different line endings, curly versus straight quotes, or letters copied from a fancy-font generator can all hide the changes you care about. This guide explains what "ignoring formatting" does during a comparison, how to choose which differences to ignore, and how to check whether the result is usable where you need it.

What ignoring formatting actually changes

A text comparison, often called a diff, works on stored characters, not on how the text looks on screen. That splits formatting differences into two groups. The first group is pure presentation, such as bold or italic styling in a word processor, a font choice, or CSS applied on a web page. None of that is stored in the characters themselves, so a plain-text comparison never sees it. The second group consists of differences that are real characters even though they look like formatting: extra spaces, tabs, line endings, letter case, typographic punctuation, invisible characters, and Unicode lookalike letters.

An ignore option deals with the second group. Typically it normalizes both inputs according to a rule, such as collapsing runs of spaces or converting everything to lowercase, and then compares the normalized versions. Whether a particular tool changes your original text or only its own working copy depends on that tool. Check its documentation, or compare what you paste in with what you copy out.

  • Trailing spaces or tabs at the end of a line
  • Runs of spaces versus a single space, or tabs versus spaces
  • Windows line endings (CR LF) versus Unix line endings (LF)
  • Extra blank lines
  • Uppercase versus lowercase letters
  • Curly quotes and apostrophes versus straight ones, or en and em dashes versus hyphens
  • Non-breaking spaces and zero-width characters that look like ordinary spacing or nothing at all
  • Styled Unicode letters, such as mathematical bold or italic letters, that look like formatted text

Where styled, reversed and mirrored text fits

Several text effects are easy to confuse. The labels "mirror text" and "font generator" do not tell you how the effect is built, so it helps to know which kind of change you are dealing with before choosing comparison settings.

Unicode character substitution replaces ordinary letters with different code points that resemble styled text, such as MATHEMATICAL BOLD CAPITAL N in place of N. A strict comparison treats every substituted letter as a change. Unicode compatibility normalization (NFKC, defined in the Unicode Standard) maps many of these characters back to their base letters, so a comparison that applies NFKC can treat them as equal. Some substitutes have no compatibility mapping, including small-capital letters such as LATIN LETTER SMALL CAPITAL A and upside-down letters such as LATIN SMALL LETTER TURNED A. Normalization leaves those unchanged, so they still show as differences.

Character-order reversal changes the stored sequence. Comparing reversed text with its original shows nearly every position as different, and no whitespace or case option fixes that. Reverse one side back first. Simple reversal tools may also split combining accents or multi-part emoji, so a round trip may not reproduce the original exactly.

Visual mirroring with CSS, such as a horizontal flip transform, changes only how the text is drawn. The stored characters stay in their normal order, so copied text and comparisons see the original, and there is nothing to ignore.

Bidirectional display is handled the same way. Right-to-left scripts are stored in logical order and arranged visually at display time, and a diff compares the logical order. The exception is invisible directional control characters, such as RIGHT-TO-LEFT OVERRIDE. These are stored characters, so two lines can look identical on screen and still differ. A tool that reveals invisible characters, or a hex or code-point view, will show them.

Choosing which differences to ignore

Every ignore option trades sensitivity for less noise. The table below lists common options by what they treat as equal and what they can hide. Option names and exact behavior vary between tools, so confirm the definitions in the documentation of whichever tool you use.

Option | Treats as equal | Suits | Can hide
Ignore trailing whitespace | Lines that differ only by spaces or tabs at the end | Prose, most source code | Significant trailing spaces, such as Markdown line breaks
Ignore whitespace changes | Different amounts of spacing between words | Re-wrapped or re-indented prose | Indentation changes in whitespace-sensitive formats such as Python or YAML
Ignore all whitespace | Lines that differ only by any spacing, including none | Spotting word-level edits after heavy reformatting | Words merged or split, such as "login" versus "log in"
Ignore line endings | CR LF and LF | Files edited on different operating systems | Rarely anything meaningful
Ignore blank lines | Added or removed empty lines | Prose with paragraph spacing changes | Structural changes where blank lines carry meaning
Ignore case | Uppercase and lowercase forms | Headings, labels, case-insensitive identifiers | Meaningful case changes, such as proper nouns or case-sensitive code
Unicode NFC normalization | Precomposed and decomposed accented letters | Multilingual text from different sources | Very little; this is usually safe
Unicode NFKC normalization | Styled letters, full-width forms, ligatures, superscripts and their base forms | Text pasted from font generators or PDFs | Meaningful distinctions, such as xΒ² versus x2
Punctuation folding | Curly and straight quotes, dash variants | Drafts that passed through a word processor | Deliberate typographic edits

A practical rule is to start narrow. Ignore line endings and trailing whitespace first, look at what remains, and add broader options only when they remove noise you have confirmed is irrelevant. For code or structured data, keep indentation and case visible unless you know the format ignores them. For prose under review, broader whitespace and punctuation folding usually help, but run a strict pass at the end if exact wording matters, as it does in contracts or published copy.

The following matched pair is illustrative. The results show how the options are defined to behave, not output observed from any particular tool.

Version A                      Version B
-----------------------------  -----------------------------
Ship by Friday.␠␠              Ship by Friday.
STATUS: open                   Status: open
𝐍𝐨𝐭𝐞: draft                    Note: draft
Price: β€œten” dollars           Price: "ten" dollars

(␠ marks a trailing space)
Line pair | Difference | Option that treats it as equal (illustrative)
Ship by Friday. | Two trailing spaces | Ignore trailing whitespace
STATUS / Status | Letter case | Ignore case
Note: draft | Mathematical bold letters | NFKC normalization
Price: "ten" | Curly versus straight quotes | Punctuation folding only; NFKC does not convert curly quotes

Comparing rich text: what gets lost and what to use instead

Most text comparison pages accept input in plain-text fields. A standard HTML text area holds plain text only, so pasting from a word processor into one drops bold, italics, colors, and links and keeps only the characters. That is often what you want. It also means a plain-text comparison cannot tell you that someone bolded a phrase or changed a heading style. If those changes matter, use a document-comparison feature in an application that understands the file format, and keep plain-text comparison for wording changes.

Pasting does not strip everything. Non-breaking spaces, zero-width characters, directional controls, curly quotes, and styled Unicode letters are all real characters, so they survive the paste and can show up as differences that look like formatting.

Will the result stay readable and usable?

Normalization is useful for comparing and risky for publishing. If a tool lets you copy normalized text, that text may no longer match the source. NFKC, for example, turns superscripts into ordinary digits, splits ligatures into separate letters, and converts full-width characters to standard width. Use normalized output to find changes, then make your edits in the original document.

Styled Unicode letters raise an accessibility issue too. Because they are separate symbols, not formatted letters, screen readers handle them inconsistently. Depending on the screen reader and its settings, they may be announced by character name, spelled out, or skipped. Search and spell-check may also fail to match them. If the final text needs to be accessible or searchable, use ordinary letters and apply styling through the destination's own formatting controls, then test with the assistive technology your audience uses.

Clipboard behavior follows the same split as before. CSS effects and word-processor styling do not travel as characters in plain-text copies, while substituted characters and invisible characters do. Before relying on transformed or compared text, check it in the destination.

  • Paste a sample into the destination and confirm it displays as expected
  • Search the destination for a word from the sample to confirm it is findable
  • Turn on a show-invisibles view, where available, to catch non-breaking spaces and zero-width characters
  • If exact wording matters, run a final strict comparison with no ignore options

Handling sensitive text

An online comparison page may process text entirely in your browser or send it to a server, and you cannot tell which from how the page looks. Before pasting contracts, credentials, personal data, or unreleased material, read the service's documentation or privacy policy about how input is processed and kept. If that is unclear, compare locally instead. Command-line tools document ignore options similar to those in the table above, and a short script can apply exactly the normalization you choose.

# GNU diff: ignore case, whitespace amount changes, blank lines and CR at line end
diff -i -b -B --strip-trailing-cr version-a.txt version-b.txt

# Git, outside a repository: ignore all whitespace and CR at line end
git diff --no-index -w --ignore-cr-at-eol version-a.txt version-b.txt
import difflib
import unicodedata

def normalize(text):
    text = text.replace("\r\n", "\n")
    text = unicodedata.normalize("NFKC", text)
    lines = [" ".join(line.split()) for line in text.split("\n")]
    return [line.casefold() for line in lines]

with open("version-a.txt", encoding="utf-8") as a, open("version-b.txt", encoding="utf-8") as b:
    for line in difflib.unified_diff(normalize(a.read()), normalize(b.read()), lineterm=""):
        print(line)

The script normalizes line endings, applies NFKC, collapses whitespace, and ignores case. Remove any step you do not want. It does not fold curly quotes, so add an explicit character replacement if you need that.

Limits of this guide

No specific online comparison service was tested for this guide, so it makes no claims about any service's options, accuracy, or data handling. The example results show how each option is defined to behave, not observed output. Screen reader and clipboard behavior varies by software and version, so verify them in your own environment.