Paste your original Python file in the left panel and the updated version in the right panel, then click Find Differences. Added lines appear in green, removed in red. Upload .py or .ipynb files directly. All processing runs in your browser - no code is sent to a server.
How to use this tool
Paste or upload your original Python file on the left and the changed version on the right. Click "Find Differences." The diff shows every line that was added, removed, or unchanged, with line numbers. Toggle between Unified view and Side-by-Side view using the buttons above the output.
The Sample button loads two versions of a short Python function so you can see how the output looks before pasting your own code. The language is pre-selected as Python, so the file upload dialog filters to .py, .pyw, .pyx, and .ipynb files.
What to look for in Python diffs
Python's syntax has a few properties that affect how diffs read:
Indentation changes
Python uses indentation as syntax. A line moved inside or outside a block will appear as a change even if the code content is identical. Watch for lines that are removed and re-added with different leading whitespace - this usually means a refactor moved a block rather than changing its logic.
Docstring and comment additions
Docstrings (triple-quoted strings) and comments are treated as plain text lines. A newly added docstring will appear as several consecutive green lines, typically at the top of a function or class.
f-string and format string updates
A change from % formatting to f-strings will show as a removed line and an added line per string. The line counts will match if the logic was not otherwise changed.
Use cases
Reviewing refactored functions
Paste the before and after versions of a refactored Python function to confirm no logic was accidentally dropped or altered. Side-by-side view makes it easy to read both versions in parallel.
Comparing scripts between environments
When a Python script differs between development and production, paste both versions to immediately see which lines changed - often just configuration constants or logging levels.
Checking AI-assisted edits
When an LLM rewrites a Python function, paste the original and the new version side by side to verify the logic is preserved and only the requested changes were made.
FAQs
Can I compare .ipynb Jupyter notebook files?
Yes. Jupyter notebooks are JSON files. The diff will compare the raw JSON content, which includes cell source, outputs, and metadata. For a cleaner diff of just the code, export the notebook as a .py script first (File → Download as → Python).
Does this check Python syntax or run the code?
No. The tool compares the files as plain text. It does not execute code, check for errors, or validate indentation semantics.
Is my Python code private?
Yes. Everything runs in your browser. No code is sent to any server.