
difftastic
Structural diff tool that compares files based on their syntax rather than lines
Difftastic is a structural diff tool that analyzes and compares files based on their parsed syntax trees rather than line-by-line differences. It parses source code into abstract syntax trees (ASTs) and uses Dijkstra's algorithm to identify the actual syntactic changes between files. This approach allows it to understand when changes are purely cosmetic (like whitespace or formatting) versus substantive code modifications.
The tool supports over 30 programming languages and integrates with version control systems including Git and Mercurial. When difftastic encounters files it cannot parse or unsupported file types, it falls back to a line-oriented diff with word highlighting. It can handle merge conflicts by parsing conflict markers and diffing the conflicting sections, and offers a --check-only mode for quickly determining if files have syntactic differences without generating a full diff.
Difftastic displays results in a side-by-side format and can be configured through environment variables like DFT_PARSE_ERROR_LIMIT and DFT_BACKGROUND. However, it has known performance limitations with large files containing many changes and high memory usage. The tool is designed for human consumption rather than generating patches, making it complementary to traditional diff tools rather than a replacement for patch-based workflows.



Alternatives & related tools
fnm
Fast Node.js version manager built in Rust with support for .node-version and .nvmrc files
hyperfine
Command-line benchmarking tool that runs statistical analysis across multiple timing runs of shell commands
Hurl
Command line tool that runs and tests HTTP requests defined in plain text files, with request chaining, captures, asserts, and CI reports.
asciinema
Command-line tool for recording and live streaming terminal sessions to lightweight asciicast files
mise
CLI tool for managing development environments with version-controlled tools, environment variables, and tasks
add a badge to your README
Maintain difftastic? Show that it's featured on trmn. The badge links back to this page.
[](https://www.trmn.sh/tools/difftastic?utm_source=badge)<a href="https://www.trmn.sh/tools/difftastic?utm_source=badge"><img src="https://www.trmn.sh/badge/difftastic.svg" alt="Featured on trmn" height="20"></a>