Skip to content

Repository files navigation

TextDiffTool

A modern, browser-based text comparison tool that highlights differences between two text inputs with line-level and character-level diff visualization.

Text Compare Mode

More Screenshots

JSON Edit Mode

JSON Compare Mode

Settings Modal

Try it now: https://aforemendude.github.io/text-diff-tool/

Features

  • Side-by-side comparison – View original and modified text in a split display
  • Line-level diffing – Highlights added, removed, and modified lines
  • Character-level diffing – Shows exact character changes within modified lines
  • Collapsible unchanged sections – Automatically hides large blocks of identical lines to focus on changes
  • Edit/Compare toggle – Switch between editing text and viewing differences
  • JSON Mode – Normalizes JSON by sorting keys and formatting with consistent indentation before comparison
  • Static deployment – Builds to static files

Privacy and Security

  • Local Processing – All data processing happens locally in your browser. No data is ever sent to a remote server.
  • No Trackers – This tool is free of ads and trackers.

Getting Started

Prerequisites

  • Node.js ^20.19.0 || ^22.12.0 || >=24.0.0
  • npm 11 (the reproducible package-manager version is recorded as npm 11.17.0)

The Node.js range is the intersection of the Vite 8 and Vitest 4 requirements, the strictest constraints in the installed dependency tree. The same range and the npm major are enforced for repository commands through devEngines.

Installation

npm install

Playwright also needs its browser binaries. Choose the command for your environment:

# macOS or Windows
npm run playwright:install

# Supported Linux distributions and Linux CI/container environments
npm run playwright:install -- --with-deps

The Linux command installs both the browsers and their required system packages, and may prompt for sudo. If the browsers are already installed and you only need the system packages, run:

npm run playwright:install-deps

Development

Start the development server:

npm run dev

Regenerate the README screenshots with Playwright at a 1280×720 viewport:

npm run screenshots

A full run clears the screenshots/ directory first. Pass an output basename or filename to recreate only that image without deleting the other files, for example:

npm run screenshots -- settings_modal

Build

Build for production (outputs to docs/ for GitHub Pages):

npm run build

Preview the production build:

npm run preview

Tests

Run the Playwright end-to-end tests (the production build runs first, then a fresh preview server starts automatically):

npm run integration

This command never reuses a process already listening on the preview port (4173); an occupied port is reported as an error so the tests cannot accidentally run against an unrelated build.

To test against an already-running development server, set BASE_URL and use the development integration script. This skips both the production build and preview server. Extra arguments can select a focused spec or browser:

BASE_URL=http://localhost:5173 npm run integration:dev -- playwright/comparison.spec.ts --project=chromium

Run the Vitest unit tests:

npm run test

See Testing strategy and catalog for the boundary between unit and browser coverage and the complete Playwright inventory.

Format Code

npm run format

Deploy

Install dependencies, verify the lockfile, run all checks, and rebuild the tracked docs/ deployment without committing or pushing it:

npm run deploy

Usage

  1. Enter or paste text in the Original and Modified text areas
  2. Click the Compare button to view the diff
  3. Click Edit to return to editing mode

License and Credits

TextDiffTool is licensed under the MIT License.

The TextDiffTool logo is original artwork created for this project and is distributed under the same MIT License.

Copyright and license terms for the JavaScript libraries shipped in the browser bundle are collected in the third-party software notices.

The interface uses Inter, and editable and compared text uses JetBrains Mono. Both font families are self-hosted and licensed under the SIL Open Font License 1.1. The required copyright and license notices are distributed beside the font files:

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages