Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a diff tool I can run from the command line or maybe just an online webpage that will compare single lines? GitHub diffs do this but I'm don't want to publish things to GitHub just to read the diffs!

This is the sort of thing I'm wanting to diff:


I'm on Mac OS X.

share|improve this question

migrated from stackoverflow.com Oct 14 '09 at 1:49

This question came from our site for professional and enthusiast programmers.

What operating system? –  silky Oct 14 '09 at 1:34

7 Answers 7

up vote 1 down vote accepted

diff_match_patch works in the browser.

share|improve this answer
Yay! This works. Thank you –  Ollie Saunders 6 hours ago

I use fold to wrap lines at a fixed width before using opendiff to diff them. It's hardly elegant, but it's really hard to find a line-line diff'er.

share|improve this answer
nice because fold available on most platforms. In mac/bash: diff <(cat file1.sql | fold) <(cat file2.sql | fold) –  hobs Jan 11 '13 at 21:30
fold displays the text naturally so you can also do diff <(fold file1.sql) <(fold file2.sql). Try adding the -w 25 param to fold change the line length. –  Steve Tauber Jan 24 '14 at 17:44
  1. You can break the line into 'words' (by say changing all ':' chars with a single whitespace). And then use wdiff which will do a word-diff forming words at the whitespaces.

  2. You could load the two files in KDiff3, it will highlight the difference (for long lines too).

share|improve this answer
brew install kdiff3 or similar for mac –  hobs Jan 11 '13 at 21:24

kompare will highlight the individual characters that differ.

Wikipedia has a fairly extensive comparison of diff-style tools here.

share|improve this answer

I just realized that FileMerge will highlight differences insides lines, although it doesn't seem to have an option to wrap long lines, which is annoying.

share|improve this answer

If you know vi or vim at all, I would suggest using vimdiff. Differences will be highlighted. Starts with a vertical split, you can use "vimdiff -o a.txt b.txt" for a horizontal split instead (might be better for a single line).

share|improve this answer

I solved the problem with the linewrapping with https://www.diffchecker.com/ You can save the website locally and it still work. It shows you the differences (also in line) und wraps the lines.

share|improve this answer
Just tried this with the example data used in the initial post; didn’t work at all, just said the whole two lines were different. –  Ollie Saunders 6 hours ago

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.