Bandingkan Teks

Tren 🔥

Bandingkan dua teks dan sorot perbedaannya.

Alat Developer

Cara Menggunakan Bandingkan Teks

  1. 1Tempel teks asli di Teks A
  2. 2Tempel teks yang dimodifikasi di Teks B
  3. 3Klik Bandingkan untuk melihat perbedaan
  4. 4Tinjau output diff berkode warna

Tentang Bandingkan Teks

Text Compare (Diff) memungkinkan Anda menempelkan dua versi teks ke panel berdampingan dan langsung melihat perbedaannya. Baris yang hanya ada di Teks B (versi baru) disorot hijau sebagai penambahan, baris yang hanya ada di Teks A (asli) disorot merah sebagai penghapusan. Semua perbandingan berjalan secara lokal di browser Anda.

Fitur Utama Bandingkan Teks

  • 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

Contoh

Compare two versions of a configuration file

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

Input

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

Output

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.

Input

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

Output

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

Kasus Penggunaan Umum

  • 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

Pemecahan Masalah

Expecting word-level or character-level diff highlighting

Solusi

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

Solusi

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

Solusi

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.

Pertanyaan yang Sering Diajukan

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.