Сравнение текстов

В тренде 🔥

Сравните два текста и выделите различия.

Инструменты разработчика

Как использовать Сравнение текстов

  1. 1Вставьте оригинальный текст в Текст A
  2. 2Вставьте изменённый текст в Текст B
  3. 3Нажмите Сравнить, чтобы увидеть различия
  4. 4Просмотрите вывод diff с цветовой кодировкой

О Сравнение текстов

Инструмент сравнения текстов (Diff) позволяет вставить две версии текста в панели бок о бок и мгновенно увидеть различия. Строки, присутствующие только в Тексте B (новой версии), выделяются зелёным как добавления, строки только в Тексте A (оригинале) — красным как удаления. Всё сравнение выполняется локально в браузере.

Ключевые возможности Сравнение текстов

  • Line-by-line comparison of two text versions
  • Green highlights for lines added in Text B (new version)
  • Red highlights for lines removed from Text A (original)
  • Gray display for unchanged lines
  • Shows a summary count of added and removed lines
  • Works on any text — documents, code, config files, contracts
  • Instant comparison with no submit delay
  • Runs entirely in-browser with no data transmission

Примеры

Compare two versions of a configuration file

Identify which settings were changed between the old and new version of a config file.

Входные данные

Text A: timeout=30
retries=3
log_level=info
Text B: timeout=60
retries=5
log_level=debug

Результат

Red: timeout=30, retries=3, log_level=info
Green: timeout=60, retries=5, log_level=debug

Review edits made to a contract paragraph

Spot every changed line between an original contract draft and the revised version.

Входные данные

Text A: The payment is due on the 1st.
Text B: The payment is due on the 15th.

Результат

Red: The payment is due on the 1st.
Green: The payment is due on the 15th.

Типичные сценарии использования

  • Comparing two versions of a document to spot editorial changes
  • Identifying which configuration file lines changed between deployments
  • Reviewing contract or legal document revisions for changed clauses
  • Comparing exported data files to find rows added or removed
  • Auditing changes made to policy documents or terms of service
  • Comparing two versions of a README or documentation page

Устранение неполадок

Expecting word-level or character-level diff highlighting

Решение

This tool performs line-by-line comparison only. A changed line appears as both removed (red) and added (green) — the exact word or character that changed within the line is not highlighted separately. For character-level diff, you need a more advanced diff tool.

Whitespace differences not showing up as changes

Решение

Trailing spaces, tabs, or line ending differences (CRLF vs LF) that appear identical visually may or may not be detected as differences depending on how comparison is normalized. If you expect whitespace changes to be highlighted, ensure both texts use consistent line endings.

Reordered blocks showing many red and green lines instead of a swap indicator

Решение

The tool performs a line-by-line sequential diff, not a block-move detection. If a paragraph was moved from the middle to the top, it will appear as removed from its original position (red) and added at its new position (green) — not as a "moved" indicator.

Часто задаваемые вопросы

Is the comparison case-sensitive?

Yes. By default, line-by-line comparison is exact and case-sensitive. A line reading "Hello" and a line reading "hello" are treated as different and will appear as a removal and addition respectively.

What do the colors mean?

Green lines are present in Text B (the new version) but not in Text A (the original) — these are additions. Red lines are present in Text A but not in Text B — these are removals. Gray lines appear in both texts unchanged.

Does it detect word-level changes within a line?

No. The tool compares entire lines. If one word in a line changes, the whole line appears as removed (red) and replaced by the new version (green). Character or word-level highlighting is not provided.

Can it compare code files?

Yes. Since it operates on plain text, it can compare any text-based files including source code, configuration files, JSON, YAML, and Markdown. Paste the file contents into Text A and Text B.

What algorithm is used for the diff?

The tool uses a standard longest common subsequence (LCS) algorithm, the same approach used by Unix diff and git diff, to identify the minimum set of additions and removals that transform Text A into Text B.

Is there a text length limit?

No. Comparison runs locally in your browser. Long documents with hundreds of lines are compared instantly without any server interaction.

Is my text sent to a server?

No. All comparison runs in client-side JavaScript. Your text is never uploaded, stored, or transmitted to any server.

Can I compare texts with different line endings (CRLF vs LF)?

The tool normalizes line endings before comparison, so Windows CRLF and Unix LF line endings are treated as equivalent. This prevents spurious "all lines changed" results when comparing files from different operating systems.