Compare Code Online
Paste two versions of your code to see every added, removed and changed line highlighted, with syntax highlighting.
Give Rating
Compare code online and find every difference
Paste two versions of a file, function or snippet and TextCompare shows every added, removed and changed line, with the exact characters that changed marked inside each line. Syntax highlighting covers JavaScript, TypeScript, Python, Java, C#, Go, Rust, SQL and more than 30 other languages.
It is a quick online code diff checker for when git is not to hand: a snippet from a ticket, the same config file from two servers, or code someone pasted in a chat. Everything runs in your browser.
How to compare code online
Paste the original code
Paste it on the left, drop a source file, or load one from a URL, Google Drive or OneDrive. URL and cloud imports set the language from the file extension.
Paste the new code
Do the same on the right, and pick the language in the toolbar if it is not already set.
Click Compare
Changed lines are highlighted, with the changed characters marked inside them.
Format, review and share
Format minified code, step through the changes, comment on lines, and share the diff as a link or a PDF.
Built for comparing code
Syntax highlighting for 35+ languages
Including C, C++, PHP, Kotlin, Swift, Dart, Ruby, Shell, Dockerfile and GraphQL.
Character-level diff
See the exact characters that changed inside a line, not just which lines changed.
Format
Re-indent minified or messy JavaScript, TypeScript, HTML, JSON and XML on both sides before you compare.
Side-by-side or inline
Read the two versions next to each other, or as one column like a unified diff.
Hide unchanged regions
Collapse the matching code so only the changes and a few lines around them remain.
Comments for code review
Leave a comment on a line, as you would in a pull request, and share the comparison with your team.
Keyboard navigation
Jump between changes with N and P, and between comments with J and K.
Export
Download a PDF report, or a unified .txt diff you can attach to a ticket.
What developers compare
Code review without a repository
Compare two versions of a snippet from a ticket, an email or a chat.
Config drift
Diff the same config file from two servers or two environments.
Generated code
Check what a code generator, formatter or AI assistant changed in your file.
Teaching and learning
See what changed between a student's attempt and the model answer.
Getting a cleaner comparison
The whole file is highlighted after reformatting
Click Format so both sides use the same indentation. Trim whitespace, on by default, also ignores spaces at the start and end of lines.
Minified code is one long line
Format spreads JavaScript, TypeScript, HTML, JSON and XML over separate lines so the changes line up.
A moved function shows as removed and added
A line diff cannot follow code that moved. Paste just the two versions of that function to compare them directly.
Frequently asked questions about comparing code
Which programming languages are supported?
Syntax highlighting covers JavaScript, TypeScript, Python, Java, C#, C++, PHP, Go, Rust, Kotlin, Swift, SQL, HTML, CSS, JSON, XML, YAML and more. Any plain text can be compared too.
Can I compare two files without git?
Yes. Paste or upload both versions; there is nothing to commit and no repository to set up.
Does it ignore whitespace and indentation?
Trim whitespace, on by default, ignores spaces at the start and end of lines, and Format re-indents both sides for supported languages.
Can I share a comparison?
Yes. Save it online to get a link that opens the same comparison, comments included, for anyone you send it to.
Is my data stored?
No, comparisons run entirely in your browser.