Why line diffs feel simple but read differently from tools you already use
This page compares two pasted texts by splitting on line feeds only: the diff kernel is longest-common-subsequence (Myers-style) over the line arrays, so it finds an order-preserving alignment, not “moves” or intra-line edits. Windows CRLF is preserved in what you paste; only the \n boundaries define rows. When you need column order noise gone, align keys first with JSON key sorter or pretty-print both sides in JSON formatter & beautifier before diffing.
Side-by-side highlighting is editorial review: it does not parse JSON/YAML/SQL semantics. For structured payloads, a tree diff (e.g. JSON compare) can still disagree with line diff when keys reorder or when minified blobs sit on one line. For byte-level or character-level budgets after edits, cross-check with text statistics so limits from Twitter bios or DB VARCHAR caps stay honest.
What line-based LCS diff assumes, and where semantic or byte tools diverge
How the line alignment is built from a longest common subsequence over rows
- Each row is one string ending at the next \n; no automatic CRLF normalization—only those boundaries split “lines”.
- The LCS walks both arrays to maximize unchanged rows while keeping original order; it does not label blocks as “moved”, only delete/insert pairs.
- Identical rows that repeat can match either occurrence; reviewers sometimes see a “wrong” pairing when duplicates abound—dedupe or add sentinel comments first.
- Empty strings between newlines are real lines: an extra blank line is an added row, not invisible padding.
Why changed characters inside one line make the whole row “red then green”
- There is no intra-line token diff here—one stray tab or comma makes the entire line a removal plus an addition.
- That matches many config reviews (helm values, .env) where a line is the deployable unit; it punishes prose where edits are word-sized.
- Word-wrapped paragraphs without inner newlines become one giant row: prefer hard breaks, Markdown source, or a paragraph-specific tool when you need finer grain.
- Trailing spaces and non-breaking spaces are part of the line string; they cause “no visible change” mysteries until you hex or normalize.
When to normalize newlines, pretty-print, or sort before a fair comparison
- CRLF vs LF-only often produces a full-file churn—convert both sides the same way or diff will shout on every line ending.
- Minified JSON is a single line: any edit retouches that line; use the formatter to expand structure, or use JSON compare for object-aware diffs.
- Key order in JSON objects is semantically irrelevant but line-noisy; sorting keys removes false positives when the schema is stable.
- Large logs benefit from slicing timestamps or request IDs the same way on both sides so LCS aligns error lines instead of interleaving unrelated stacks.
What this differs from git diff, Word track changes, or ICU collators
- Git adds file headers, hunk limits, and optional word-diff; this page is only equal-line alignment with no repository merge base.
- Word counts revisions and author balloons; it may treat soft breaks and fields differently from raw \n rows.
- Unicode normalization (NFC/NFD) can make two visually identical lines differ at the code-unit level—normalize both sides when enforcing AML or legal copy.
- Binary, Word .docx, and PDF need importers or hex tools; paste extracted plain text here only after decoding.
Where a fast line diff beats a semantic diff, and where it does not
Helm values or .env before a rollout
Line units match what operators eyeball in PR comments—pair with secret scanners elsewhere; here you only see literal text drift.
API JSON bodies after pretty-print
Once both sides share indentation, line diff highlights field-level edits; still verify ordering requirements if your client compares canonical JSON bytes.