Initializing, please wait a moment

Text vs Line vs Word vs Git Diff

Last reviewed 2026-04-27. Open the text-diff tool to compare two strings, files, or pasted blocks in your browser.

30-second answer. Four kinds of diff each answer a different question. Text diff: are these two strings byte-equal, and if not, where do they differ? Line diff: which lines changed (the standard for code review). Word diff: which words changed inside changed lines (the standard for prose). Git diff: which lines changed between two commits in tracked history (line diff plus version-control context).

The four flavors and what each one is for

  • Text diff (string diff). The simplest. Compare two strings or two text blocks character-by-character. Outputs the locations where they differ. Right for "are these two pasted blobs really identical?" - JSON config drift, error messages in support tickets, log lines that should match.
  • Line diff. The default for code. Treat each line as the unit of change. Output: which lines were added, removed, or modified. The "+" / "-" output every code-review tool uses. Strong default when the underlying content is line-structured.
  • Word diff. Right for prose. When a sentence changes a single word, line diff shows the entire sentence twice (once - and once +). Word diff highlights only the changed word. Better for editorial review and content changes.
  • Git diff. Line diff plus repository history. Compares two commits, two branches, working-tree-vs-index, or index-vs-HEAD. Adds the file-mode, rename detection, and binary-file handling that pure line diff lacks. Used inside version-control workflows.

When line diff is wrong

Line diff fails when the lines themselves are long. Edit one word in a 200-character line and the diff shows the entire line as removed-and-readded - no signal about which word actually changed. Same for one-line JSON or minified code where everything is on a single line.

Two fixes: re-format the input first (pretty-print JSON, run a code formatter), then line diff. Or switch to word diff, which handles long lines correctly. Most online tools offer both - pick based on whether the input is naturally line-structured.

When git diff adds value over line diff

Three things git tracks that pure line diff cannot:

  • File renames. Move a file from src/foo.js to src/bar.js. Line diff shows it as "all of foo.js deleted, all of bar.js added". Git diff with rename detection shows it as "foo.js renamed to bar.js" plus any actual content changes.
  • File mode changes. Marking a script as executable shows up in git diff as a mode change with no content delta. Line diff misses it entirely.
  • Binary file changes. Git diff says "binary files differ" without trying to render the bytes. Line diff produces unreadable output for any binary input.

Pick the right one for the task

Comparing two pasted strings: text diff. Reviewing code changes: line diff or git diff if you have repository context. Reviewing copy edits: word diff. Investigating an unexpected production drift: text diff first to confirm the difference exists, then line diff to localize it. The text-diff tool covers the first three; git diff lives inside git itself. The full developer set is at the developer tools hub.

← Back to All Guides

Why trust these tools

  • Ten-plus years of web tooling. The freetoolonline editorial team has shipped browser-based utilities since 2015. The goal has never changed: get you to a working output fast, without an install.
  • Truly in-browser - no upload. Every file-processing tool on this site runs in your browser through modern Web APIs (File, FileReader, Canvas, Web Audio, WebGL, Web Workers). Your photo, PDF, audio, or text never leaves your device.
  • No tracking during tool use. Analytics ends at the page view. The actual input you paste, drop, or capture is never sent to any server and never written to any log.
  • Open-source core components. The processing engines underneath (libheif, libde265, pdf-lib, terser, clean-css, ffmpeg.wasm, and others) are public and audit-able. We link to each one in its tool page's footer.
  • Free, with or without ads. All tools are fully functional without sign-up. The Disable Ads button in the header is always available if you need a distraction-free run.