Initializing, please wait a moment

Text vs Line vs Word vs Git Diff

Lan ra soat cuoi 2026-04-27. Mo cong cu text-diff de so sanh hai chuoi, tep, hoac khoi dan trong trinh duyet ban.

Cau tra loi 30 giay. Bon loai diff moi loai tra loi mot cau hoi khac nhau. Text diff: hai chuoi nay co byte-bang nhau, va neu khong, chung khac o dau? Line diff: dong nao da thay doi (tieu chuan cho code review). Word diff: tu nao da thay doi trong cac dong da doi (tieu chuan cho van xuoi). Git diff: dong nao da thay doi giua hai commit trong lich su duoc theo doi (line diff cong boi canh kiem soat phien ban).

Bon huong vi va moi loai dung de lam gi

  • Text diff (string diff). Don gian nhat. So sanh hai chuoi hoac hai khoi van ban tung ky tu. Dau ra: cac vi tri noi chung khac. Dung cho "hai blob dan nay co thuc su giong het nhau khong?" - drift cau hinh JSON, thong bao loi trong ticket ho tro, dong log nen khop.
  • Line diff. Mac dinh cho code. Coi moi dong la don vi thay doi. Dau ra: dong nao da duoc them, xoa, hoac sua. Dau ra "+" / "-" ma moi cong cu code-review dung. Mac dinh manh khi noi dung co ban duoc cau truc theo dong.
  • Word diff. Dung cho van xuoi. Khi mot cau thay doi mot tu duy nhat, line diff hien ca cau hai lan (mot lan - va mot lan +). Word diff danh dau chi tu duoc thay doi. Tot hon cho review bien tap va thay doi noi dung.
  • Git diff. Line diff cong lich su kho. So sanh hai commit, hai branch, working-tree-vs-index, hoac index-vs-HEAD. Them phat hien file-mode, phat hien rename, va xu ly tep binary ma line diff don thuan thieu. Duoc dung trong luong cong viec kiem soat phien ban.

Khi nao line diff sai

Line diff that bai khi chinh cac dong la dai. Sua mot tu trong mot dong 200 ky tu va diff hien ca dong la xoa-va-them-lai - khong co tin hieu ve tu nao thuc su thay doi. Tuong tu cho JSON mot dong hoac code minified noi moi thu o tren mot dong duy nhat.

Hai cach sua: re-format dau vao truoc (pretty-print JSON, chay mot bo dinh dang code), sau do line diff. Hoac chuyen sang word diff, xu ly dong dai dung. Hau het cong cu online cung cap ca hai - chon dua tren lieu dau vao co duoc cau truc theo dong tu nhien khong.

Khi nao git diff them gia tri so voi line diff

Ba thu git theo doi ma line diff don thuan khong the:

  • Doi ten tep. Doi mot tep tu src/foo.js sang src/bar.js. Line diff hien la "tat ca foo.js da xoa, tat ca bar.js da them". Git diff voi phat hien rename hien la "foo.js doi ten sang bar.js" cong bat ky thay doi noi dung thuc su.
  • Thay doi mode tep. Danh dau mot script la thuc thi duoc hien len trong git diff la mot thay doi mode khong delta noi dung. Line diff bo qua hoan toan.
  • Thay doi tep binary. Git diff noi "binary files differ" ma khong co gang render byte. Line diff tao dau ra khong doc duoc cho bat ky dau vao binary.

Chon cai dung cho tac vu

So sanh hai chuoi dan: text diff. Review thay doi code: line diff hoac git diff neu ban co boi canh kho. Review chinh sua copy: word diff. Dieu tra mot drift bat ngo trong san xuat: text diff truoc de xac nhan khac biet ton tai, sau do line diff de dinh vi. Cong cu text-diff che do ba cai dau; git diff song trong chinh git. Bo developer day du o trung tam cong cu developer.

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.