Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 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.


migration rejected from May 6 '15 at 15:34

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as off-topic by mdpc, Nifle, Frank Thomas, Kevin Panko, Raystafarian May 6 '15 at 15:34

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking product, service, or learning material recommendations are off-topic because they become outdated quickly and attract opinion-based answers. Instead, describe your situation and the specific problem you're trying to solve. Share your research. Here are a few suggestions on how to properly ask this type of question." – mdpc, Nifle, Frank Thomas, Kevin Panko, Raystafarian
If this question can be reworded to fit the rules in the help center, please edit the question.

What operating system? – silky Oct 14 '09 at 1:34
up vote 2 down vote accepted

diff_match_patch works in the browser.

Yay! This works. Thank you – Ollie Saunders May 3 '15 at 9:49

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.

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).

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.


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.


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).


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

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 May 3 '15 at 9:47

protected by Nifle May 4 '15 at 16:12

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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