Text Diff Merger: Merge Two Texts Online

Compare two versions of a text, then decide for each change whether to keep the original, use the modified lines or keep both. Nothing is uploaded.

How to merge two texts

  1. Paste the older version into Original and the newer one into Modified, or use Open a file on either side. The comparison updates as you type.
  2. Each block of differences gets its own card with the removed lines in red and the added lines in green. Changed words inside a replaced line are highlighted.
  3. On every card choose Keep original, Use modified or Keep both. The bulk buttons set every card at once.
  4. Read the Merged result, then copy it or download it as a .txt file. Cards you have not decided keep the original lines.

How the comparison works

Both texts are split into lines, and identical lines at the start and end are set aside. The lines in between are compared with the Myers difference algorithm, the method behind Git's diff, which finds the shortest list of deleted and inserted lines that turns the original into the modified text. Neighboring changes are grouped into one card. Lines that are the same in both texts are always taken from the original, and long runs of unchanged lines are folded away until you open them. The ignore options compare lines after lowercasing or collapsing runs of spaces and tabs, but the merged text keeps the lines exactly as you wrote them.

Worked example

The example loaded on the first visit has three changes: Status: draft becomes Status: approved, Budget: $4,200 becomes Budget: $4,500, and a new line, Next step: send to client, is added at the end. The summary reads 3 changes, 2 lines removed, 3 lines added, 4 lines unchanged. Press Use all modified and the merged result equals the Modified text. Then press Keep original on the Budget card and the merged text keeps $4,200 while still saying Status: approved and ending with Next step: send to client.

Limits and edge cases

Frequently asked questions

How do I merge two versions of a text document?

Paste one version on each side, then pick Keep original, Use modified or Keep both on every change card. The merged result at the bottom updates with each choice. Copy it or download it when it reads right.

What does Keep both do?

It writes the original lines first and the modified lines right after them in the same spot. It is useful for combining two lists or keeping an old line next to its rewrite so you can edit it by hand afterward.

Is this a three-way merge like Git?

No. It compares two texts and lets you choose between them. A three-way merge also uses the shared ancestor to combine edits automatically and flag conflicts, which this tool does not do.

Why do two lines that look the same show as different?

The usual causes are extra spaces at the end of a line, tabs instead of spaces, or different capital letters. Turn on Ignore extra spaces and tabs or Ignore upper and lower case and the lines will match.

Source: Eugene W. Myers, "An O(ND) Difference Algorithm and Its Variations", Algorithmica 1(2), 251 to 266, 1986.