Text

Text Compare Guide: Line Differences, Spacing, Case and Reports

·

ToolMellow’s text compare tool compares an original and a changed version line by line in your browser. Paste the two texts, choose whether case or spacing differences should affect matching, then select Compare texts. The result identifies added, removed and unchanged lines with their source line numbers.

Use it to check edits to a draft, a configuration excerpt or expected output. A matching result describes the line contents under the options used; it does not establish identical file bytes, equivalent program behavior or the correctness of an edit. When changes are found, you can copy or download a plain text comparison report.

Text compare

Compare the original with the version you want to review

Put the earlier version in Original text and the newer version in Changed text. Both inputs and both options start empty or off. Select Compare texts to calculate a result. The button is disabled only when both input values are empty; a space is still input, and comparing one nonempty side with an empty side is supported.

For a small example, place alpha, beta and gamma on three original lines. On the changed side, use alpha, gamma and delta. The report keeps alpha and gamma, removes beta and adds delta. The numbers beside gamma differ because it moved from the third position to the second after the removal.

  • Start with both ignore options off when every line-content difference matters.
  • Choose options deliberately, compare, and inspect the counts and marked lines.
  • After editing either text or an option, compare again before copying the result.

Read the two line-number columns and the change marks

The first number belongs to the original text and the second to the changed text. An unchanged row has both numbers, a removal only the original number, and an addition only the changed number. Numbers count logical input lines from one; a long line wrapping visually in the editor or report does not gain another line number.

The visual minus mark is −, while the exported removal prefix uses the ordinary ASCII -. Added and removed rows also have text labels for assistive technology. The summary counts lines in this alignment, not changed words, characters, a similarity percentage or the importance of an edit.

Read the two line-number columns and the change marks
RowOriginal columnChanged columnMeaning
UnchangedLine numberLine numberThe line keys matched under the chosen options.
RemovedLine numberEmptyThis original line was not matched in the alignment.
AddedEmptyLine numberThis changed line was not matched in the alignment.

HTML Standard: textarea API values and normalized newlines

A replacement is represented through whole lines

Changing a single word can produce one removed line and one added line. This version does not highlight the changed word inside those lines. It aligns an ordered sequence of matching lines, so moving a paragraph may also produce additions and removals rather than a dedicated moved-block label.

The engine finds a longest common subsequence of comparison keys after excluding matching beginnings and endings. Repeated lines can permit several equally long alignments. When the remaining alternatives tie, this implementation takes a removal first. That deterministic choice is not evidence that the author intended a particular move or replacement.

Ignore case compares lowercase forms

Ignore upper and lower case applies JavaScript’s default lowercase conversion to each line’s comparison key. With it enabled, Alpha can match alpha. It does not alter either input or turn the copied text into lowercase. An unchanged row keeps the changed side’s original text.

Default lowercase conversion is not full Unicode case folding or a language-specific search rule. Straße and STRASSE still differ, and Latin I does not become Turkish dotless ı. Greek sigma forms can also differ after conversion. Choose this option for the distinction it actually removes, rather than assuming every language’s caseless forms become equal.

MDN: String.toLowerCaseMDN: Locale-specific lowercase conversionUnicode: Case mapping and case-folding distinctions

Ignore spacing trims and collapses whitespace within each line

Ignore differences in spacing trims whitespace from both ends of each already separated line, then replaces each remaining run of JavaScript whitespace with one ordinary space. A tab, repeated spaces and a nonbreaking space can therefore match a single space. If case is also ignored, lowercase conversion happens after this whitespace step.

The option does not remove every space: ab still differs from a b. It does not remove a blank line from the sequence or join neighboring lines. A zero-width space is not automatically removed by the JavaScript whitespace rule. Avoid this option when indentation or exact spacing is meaningful to the material you are reviewing.

MDN: String.trim and surrounding whitespaceMDN: JavaScript whitespace character-class escapes

Choose the options using a small known example

These examples describe comparison keys, not edits to your inputs. Test a representative line before comparing a large excerpt. The unchanged output row retains the right-hand original content even when its comparison key was trimmed, collapsed or lowercased.

Choose the options using a small known example
Original / changedOptionsResult
Alpha / alphaBoth offOne removed line and one added line.
Alpha / alphaIgnore caseOne unchanged line, retaining alpha.
alpha beta / alpha betaIgnore spacingOne unchanged line, retaining alpha beta.
ab / a bIgnore spacingDifferent: one space is retained in the key.
Straße / STRASSEIgnore caseDifferent: lowercase conversion is not full case folding.
A blank line / a line containing spacesIgnore spacingThese two lines can match; neither line is deleted.

Line contents are compared after line endings are handled

The comparison engine splits supplied strings at CRLF, CR or LF. Browser textarea values normally normalize line breaks to LF before the component receives them. A file using Windows-style endings and one using LF can therefore produce matching lines. This page is not a test of original file encoding, byte-order marks or byte-for-byte identity.

A final separator matters because splitting a nonempty string leaves a final empty line. For example, alpha differs from alpha\n, where the notation means alpha followed by an actual newline. A completely empty input yields no lines, whereas an input consisting of one newline yields two empty lines. Soft wrapping on a narrow screen does not insert another comparison line.

HTML Standard: textarea API values and normalized newlinesMDN: String.split and empty substrings

Similar appearance does not guarantee matching text

Unicode can represent an accented letter as one code point or as a base letter followed by a combining mark. Those strings can look identical while this comparator treats them as different. Neither option applies Unicode normalization, removes accents or resolves visually similar letters from different scripts.

The input and result text use automatic text direction, while line numbers remain left-to-right. Mixed Arabic, Hebrew, Latin and punctuation can be displayed according to bidirectional text rules. When an invisible or mixed-direction difference matters, inspect the source characters with a suitable editor; the report is not a code-point inspector.

MDN: Unicode normalization of strings

The input bound counts UTF-16 code units

Each side accepts at most 1000000 UTF-16 code units. JavaScript string length and the textarea maxlength use this measure. Many common characters occupy one unit, while a supplementary character such as 😀 occupies two; a visible combined character can occupy still more. This is not a one-million-byte or one-million-visible-character allowance.

The browser limits normal user input, and the engine independently rejects strings longer than the bound. Check the end of a very large paste rather than assuming every source character was accepted. There is no file import, streaming comparison or batch interface. Work with smaller relevant sections when reviewing large documents.

MDN: String length and UTF-16 code unitsMDN: maxlength and user-input length limits

The line limit depends on the remaining comparison rectangle

The engine first excludes equal key sequences at the beginning and end. It then multiplies the two remaining line counts. A product above 4000000 is refused with a message to compare shorter sections. This product is the admission check; the allocated table also has an extra boundary row and column.

There is no universal 2000-line-per-side cap. Two wholly differing sets of 2000 lines have product 4000000 and pass this gate, while 2001 by 2001 exceeds it. An asymmetric 1000 by 4000 also reaches the allowed boundary. A much longer pair with only a short middle difference may have a small remaining rectangle. Each input must still fit the separate text-length bound.

The line limit depends on the remaining comparison rectangle
Remaining original linesRemaining changed linesProductProduct gate
200020004000000Allowed.
200120014004001Refused.
100040004000000Allowed.
100040014001000Refused.
050000Allowed by this gate; text length still applies.

Reduce a refused job by choosing corresponding sections

When the remaining line product is too large, compare related sections from both versions. Include enough shared context to recognize where the section belongs. Counts and line numbers then describe the pasted excerpts, not positions in the complete original documents.

A successful size check is not a promise of instant rendering on every device. Many output rows or long lines still require browser memory and layout work. Enabling an ignore option can change the matching boundaries, but do that only when its semantics suit the task; do not hide meaningful differences merely to get under the limit.

Copy and Download produce a full prefixed text report

When the result contains changes, the report includes every result row, including unchanged context. Each added row starts with plus and space, each removed row with ASCII hyphen and space, and each unchanged row with two spaces. Rows are joined with LF. The report does not include the interface’s line-number columns or a legend.

For original lines alpha and old compared with alpha and new, Copy yields alpha\n- old\n+ new, with the displayed newline notation standing for actual line breaks. Copy does not append a further newline. Download adds one LF and saves a UTF-8 plain text file named toolmellow-comparison.txt. If the final row itself represents an empty input line, its row prefix is still part of the report.

MDN: Blob construction, string encoding and line endingsMDN: Clipboard.writeText and failed writes

Use the report for review; use a patch workflow for application

The familiar plus and minus marks do not make this a GNU or Git unified patch. The report has no file headers or hunk ranges, includes all unchanged rows and uses an extra space after each change marker. Feeding it to a patch application tool is not a supported workflow.

For a repository change that another person must apply, generate and inspect a patch with the relevant version-control tool. ToolMellow’s report is useful as a readable comparison attachment, but it does not merge edits, preserve original file metadata or reconstruct an original file’s byte encoding.

Git: Patch format, headers and hunks

A match uses the options from that comparison

If the alignment has no added or removed lines, the workspace shows a matching notice and hides the row list, Copy comparison and Download comparison. Raw input strings can still differ because of ignored case, ignored spacing or normalized line endings.

To investigate a surprising match, turn both ignore options off and compare again. Keep the limits of line-based input in mind: even the strict option setting does not compare original file bytes or perform semantic validation. A match does not approve a configuration, contract, translation or piece of code.

Editing does not automatically recalculate the displayed result

Typing in either input or changing an option retains the previous result, error and notice. Copy and Download continue to use that displayed result. Select Compare texts after editing; a successful comparison replaces the result and clears feedback, while a failed comparison removes the previous result and shows its error.

Try an example fills both fields with an English sample and clears the previous result, error and notice. It keeps the two option selections and waits for you to compare. Clear empties both fields, removes the result and error, and shows a cleared notice; it also keeps the options. Neither action removes a report already copied to the system clipboard or downloaded.

Use Download if the clipboard write is unavailable

Copy comparison asks the browser to write the current report to the clipboard. Clipboard availability depends on browser permissions and context. A failed write displays a message directing you to Download comparison. A success notice describes the attempted report copy, not a new comparison of any subsequently edited inputs.

Download starts a browser download of the same report with one added terminal LF. Where the file goes, whether a save prompt appears and how it is opened are browser and operating-system choices. The tool offers no PDF, rich-text, HTML or merge-file export.

MDN: Clipboard.writeText and failed writesMDN: Blob construction, string encoding and line endings

Comparison runs in the page, with intentional report exports

The comparison code uses the two input strings locally; it has no comparison upload request. Loading the site still makes normal page and asset requests. This distinction matters: local calculation does not mean that visiting the website creates no network traffic or that every browser extension and device is covered by an independent privacy guarantee.

The workspace provides no saved comparison history or share link. A fresh page load starts a new workspace. Copy intentionally places the report on the clipboard and Download intentionally creates a file, so choose those actions according to how you want the reviewed text handled.

Use the comparison to locate edits, then judge their meaning

For prose, review each added or removed line in its surrounding context. For configuration or expected program output, start with exact case and spacing unless the receiving system explicitly ignores them. A changed line may fix a bug or introduce one; this comparator does not execute code, parse a data format or assess correctness.

Text Cleaner, Case Converter and Word Counter are separate tools that can help with preparation or inspection. They do not automatically receive either input from this workspace. Keep the original versions when applying a cleanup elsewhere so that the preparation step does not silently become part of the change you are trying to review.

Common questions

How do I compare two versions of a text?

Paste the earlier version in Original text and the newer version in Changed text, choose the case and spacing options, then select Compare texts. Read the marked lines and their original and changed line numbers.

Why does one changed line appear twice?

The tool reports whole lines. A replacement can appear as a removed original line and an added changed line. It does not highlight the individual changed words or characters.

Does ignoring spacing remove all spaces?

No. It trims each line and collapses runs of JavaScript whitespace to one space. ab and a b still differ, and blank lines remain in the sequence.

Can different-looking texts produce a match?

Yes. Ignored case or spacing can make the comparison keys equal while the original strings differ. Line endings are also handled before line-content comparison. Recompare with both options off to inspect stricter line differences.

Why does a final newline count as a change?

A nonempty input ending in a line separator produces a final empty line. That line can be added or removed just like another line, even though it contains no visible letters.

Is the downloaded comparison a patch file?

No. It is a full prefixed text report without file headers or hunk ranges. Use the appropriate version-control or patch tool when you need an applicable patch.

Is there a 2000-line limit?

There is no fixed limit of 2000 lines per side. After equal beginnings and endings are excluded, the remaining line counts must have a product of at most 4000000. Each input also has a 1000000 UTF-16-code-unit bound.

Why is the old result still visible after editing?

The workspace calculates on Compare texts, not on each edit. Changing input or options leaves the previous result visible. Compare again before copying or downloading an updated report.

Are my texts uploaded for comparison?

The comparison runs locally without uploading the two texts. The site still loads through normal page and asset requests. Copy and Download intentionally export the report to your clipboard or a file.

Why is Copy comparison missing?

Copy and Download appear only when the current result contains added or removed lines. A match shows a notice without an export report; a missing or failed comparison has no result to export.

Does ignoring case work identically for every language?

It uses default JavaScript lowercase conversion, not full Unicode case folding or locale-specific matching. Some case-related forms still differ, including Straße and STRASSE.

Are the copied and downloaded reports identical?

They contain the same prefixed rows. Download adds one terminal LF and saves toolmellow-comparison.txt; Copy adds no extra terminal newline. Neither report includes the displayed line numbers.

Can I compare documents, merge edits or calculate similarity?

This workspace accepts pasted text and reports line differences. It does not import document files, merge changes, apply patches, calculate similarity percentages or check plagiarism.

What happens when I use the example or clear the inputs?

The example replaces both inputs and clears result and feedback, while keeping your options. Clear empties the inputs, removes result and error, and shows a cleared notice, also keeping the options. Existing clipboard contents and downloaded files are unaffected.

Sources and further reading

Put it into practice.

Related guides