ComparLab
Code

Processed locally in your browser

Compare Code Online

Review two versions of source code in a focused diff workspace. Choose a language, hide unchanged lines, and inspect changes without uploading code.

Live

Original

Paste or drop a file

Changed

Paste or drop a file

Your differences will appear here

Paste or upload two versions, then compare.

How it works

  1. Paste, type, or open both versions from your device.
  2. Choose the precision and cleanup options that fit your content.
  3. Review additions and removals side-by-side or as a unified diff.

Useful features

  • Syntax highlighting for popular programming languages
  • Side-by-side and Git-style unified views
  • Line, word, and character comparison precision
  • Local file loading and downloadable .diff output

Common uses

  • Reviewing script and source-file versions
  • Finding a regression during debugging
  • Inspecting configuration and pull-request-style changes

Tips for a cleaner comparison

  • Disable line wrapping for alignment-sensitive code.
  • Ignore whitespace only when indentation is not significant.
  • Hide unchanged lines to focus on a small patch.

How to compare two source-code files

Open or paste the earlier version on the left and the revised version on the right. Select the language used by the file so keywords, strings, numbers, and comments are easier to scan. ComparLab then highlights removed lines in red and added lines in green.

Use the side-by-side view when surrounding code helps explain a change. Unified view is useful when you want a compact patch-style sequence that can be downloaded as a .diff file.

Choose the right code diff precision

Line precision is the safest default for functions, configuration blocks, and broad refactors. Word precision makes renamed variables and changed expressions easier to isolate. Character precision is useful for short identifiers, operators, version strings, and punctuation.

  • Keep whitespace visible for Python, YAML, and other indentation-sensitive formats
  • Ignore whitespace cautiously when a formatter changed an otherwise equivalent file
  • Turn on Hide unchanged after confirming that the surrounding context is not needed

Supported source files and safety

The browser can read common JavaScript, TypeScript, Python, Java, C#, Go, PHP, Ruby, Rust, SQL, HTML, CSS, XML, YAML, shell, and plain-text files. Source code is displayed and compared; it is never compiled or executed.

Related comparison tools

Frequently asked questions

Does ComparLab execute my code?+

No. Source code is treated strictly as text and never executed or compiled.

Which programming languages can I highlight?+

The selector includes JavaScript, TypeScript, Python, Java, C#, Go, PHP, Ruby, Rust, SQL, HTML, CSS, XML, YAML, and shell.

Can I upload source files?+

Yes. Common source extensions up to 5 MB are read locally, and recognized extensions update the language selector.

Can I hide unchanged lines?+

Yes. Enable Hide unchanged to focus the result on additions and removals.

Choose the comparison that matches your data

Use Text Compare or Code Compare when every character and line should remain visible. Choose JSON, XML, or YAML when you want validation plus format-aware normalization, and use List Compare when the question is which values are missing, shared, or repeated. Selecting the matching tool helps remove harmless formatting noise without hiding meaningful changes.