Text Diff Tool
Description
The Text Diff Tool is a powerful utility designed to compare two pieces of text and highlight the differences. It's an essential tool for developers, writers, and anyone who needs to track changes between two versions of a document, code snippet, or configuration file. The tool offers multiple comparison levels (line, word, or character) and various options to fine-tune the comparison, such as ignoring whitespace or case sensitivity.
Features
- Side-by-Side Input: Two text areas for "Original Text" and "Modified Text" allow for easy pasting and comparison.
- Real-Time Highlighting: Differences are calculated and displayed instantly as you type, with a slight debounce for performance.
- Multiple Granularity Levels:
- Line-by-Line: Highlights entire lines that have been added or removed.
- Word-by-Word: Shows differences at the word level, ignoring whitespace changes between words.
- Character-by-Character: The most detailed view, highlighting individual character changes.
- Comparison Options:
- Ignore Whitespace: Treats multiple spaces or tabs as a single space.
- Case-Insensitive: Performs a comparison that ignores differences in letter casing.
- Ignore Blank Lines: Excludes empty lines from the comparison.
- File Upload: Directly upload two text files (
.txt
, .json
, .md
, .js
, etc.) to populate the input fields.
- Summary Statistics: Get a quick overview of the changes with counts of added and removed lines/words/characters.
- Responsive Design: The tool is fully functional on both desktop and mobile devices.
How to Use
- Enter Text: Paste or type your text into the "Original Text" (left) and "Modified Text" (right) input areas.
- Upload Files (Optional): Click the "Upload File" button for either input area to load content from a local text-based file.
- Select Options:
- Choose your desired Diff Granularity (Line, Word, or Character) from the radio buttons.
- Check the boxes for other options like Ignore Whitespace, Case-Insensitive, or Ignore Blank Lines to customize the comparison logic.
- View the Diff: The results will be displayed in real-time in the output area below.
- Green highlighting indicates additions.
- Red highlighting with strikethrough indicates deletions.
- Review Statistics: Check the summary below the output for a quantitative measure of the differences.
- Copy or Download: Use the buttons on the output area to copy the diff to your clipboard or download it as a file.