FA Dev Tools

Text Diff

Compare two strings line by line. Edit the text areas below, then click Diff.

Left0 lines
Right0 lines

Text diff

Instructions

Compares two blocks of text line by line and highlights what changed.

  1. Paste or type the original into Left and the new version into Right — both panes are editable.
  2. Turn on any options you need, then click Diff.
  3. Changed lines are highlighted in place; the stats row above says how many were added, removed or changed.

Tips

  • Ignore space diff and Ignore newline diff hide whitespace-only churn — useful after a reformat.
  • JSON (prettify before diff) parses both sides and re-prints them with every object's keys sorted, so key order and spacing stop showing up as differences. If either side is not valid JSON the diff is blocked and the error is shown.
  • Sort before diff compares two unordered lists as sets — good for config keys or ID dumps.
  • Sync To Right / Sync To Left copy one side over the other, which is the quickest way to start from a known-identical baseline.
  • Hit Example: Diff loads two sample CSV blocks, and the JSON option loads two objects that are equal but written differently.

About comparing text

What a text diff is for

A diff answers one question: what changed between two versions of the same text? Reading two long files side by side by eye misses things. A diff lines them up and marks every line that was added, removed or edited, so a one-character change in a 500-line config file is as easy to spot as a new paragraph.

Common uses are checking a config file before and after an edit, comparing two API responses, spotting what a colleague changed in a document, comparing a .env file across environments, and checking that two exports of the same data really match.

How diff algorithms work

A diff tool looks for the longest run of lines the two texts share, in the same order (the longest common subsequence). Every line outside that shared run is either a deletion from the left or an insertion on the right. The result is the shortest list of edits that turns one text into the other.

Most tools, including Git, use Eugene Myers' 1986 algorithm, which finds that shortest edit list quickly when the two texts are mostly alike. This tool uses the same approach, through the open-source diff library. It compares whole lines first, then runs a character-level diff inside each changed line, so you see exactly which word or digit moved rather than just a red line and a green line.

Why a diff can look noisier than the change

A diff is exact, not clever. Re-indenting a file, switching between tabs and spaces, or reordering lines can mark almost every line as changed even though nothing meaningful moved. A line that moved to a new position is usually shown as one deletion and one insertion, because the algorithm only knows about lines, not about intent.

Line endings are another trap. Windows files end each line with CRLF, while Linux and macOS use LF. Two files can look identical on screen and still differ byte for byte.

What this tool does

Paste the original on the left and the new version on the right, then click Diff. Results appear side by side with line numbers, and both panes stay editable. Four options cut the noise. Ignore space diff squeezes runs of spaces and tabs down to one and trims each line, so indentation changes disappear. Ignore newline diff treats CRLF, CR and LF line endings as the same. JSON (prettify before diff) parses both sides and re-prints them with two-space indentation and every object's keys sorted, so a minified object and a pretty one can be compared line by line, and two objects that differ only in key order show no difference. Sort before diff sorts each side alphabetically first, which turns the comparison into “which lines are on one side but not the other”.

The comparison runs in your browser. Your text is kept in this browser's local storage so it survives a reload, and it is not uploaded.

Frequently asked questions

How do I compare two lists and ignore their order?
Turn on Sort before diff. Both sides are sorted alphabetically before comparing, so only the lines that exist on one side and not the other are marked. This works well for ID lists, package lists and config keys.
Why does every line show as changed when the text looks the same?
Usually it is invisible whitespace: different indentation, tabs versus spaces, or trailing spaces. Turn on Ignore space diff. If the files came from different operating systems, turn on Ignore newline diff as well.
Can I compare two JSON objects whose formatting differs?
Yes. Turn on JSON (prettify before diff) and both sides are parsed and re-printed in the same layout first. If either side is not valid JSON, the tool shows the parse error instead of a diff.