テキスト比較

トレンド 🔥

2つのテキストを比較して違いを強調します。

開発者ツール

テキスト比較 の使い方

  1. 1テキストAに元のテキストを貼り付ける
  2. 2テキストBに変更されたテキストを貼り付ける
  3. 3「比較」をクリックして違いを確認する
  4. 4カラーコードされた差分出力を確認する

テキスト比較 について

テキスト比較(Diff)を使用すると、2つのバージョンのテキストを並排レイアウトのパネルに貼り付けて、違いを即座に確認できます。テキスト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.