- What algorithm does this text diff tool use?
- This tool uses the Myers diff algorithm, the same algorithm powering Git and most version control systems. The Myers algorithm efficiently computes the shortest edit script (SES) to transform one text into another, minimizing the number of operations. It uses dynamic programming to find the longest common subsequence (LCS) between two texts, then identifies additions and deletions. This approach provides accurate, human-readable diff output optimized for code review and document comparison.
- What's the difference between line-by-line and character-by-character diff?
- Line-by-line diff treats each line as an atomic unit, comparing entire lines and marking them as added, removed, or unchanged. This is ideal for code and structured documents where changes typically occur at line boundaries. Character-by-character (or inline) diff compares within individual lines, highlighting specific characters that changed. Line-level diff is faster and clearer for most use cases, while character-level provides more granular detail for small text changes or single-line edits.
- Can I compare very large text files with this tool?
- Yes, the tool can handle large text files, but performance depends on your browser and device. For files over 10,000 lines, comparison may take a few seconds. The Myers algorithm has O(ND) time complexity where N is sum of text lengths and D is edit distance. For extremely large files (100,000+ lines), consider comparing specific sections or using command-line tools like GNU diff. The tool processes everything client-side, so no file size limits from servers, but browser memory constraints apply.
- Why do whitespace-only changes show as differences?
- The diff algorithm treats whitespace (spaces, tabs, line breaks) as significant characters by default. A line with trailing spaces differs from the same line without spaces. This is intentional for code comparison where whitespace can affect behavior (Python indentation, Makefiles). To avoid whitespace noise: trim trailing spaces before comparison, use consistent line endings (LF vs CRLF), normalize indentation (spaces vs tabs). Some advanced diff tools offer 'ignore whitespace' options, which this tool may add in future updates.
- Is my text data safe when using this tool?
- Absolutely. This tool operates entirely in your browser using client-side JavaScript. Your text data never leaves your device or gets uploaded to any server. All comparison calculations happen locally in your browser memory. When you close the page, all data is discarded. This makes it safe for comparing sensitive documents, proprietary code, or confidential information. For maximum security, you can even use the tool offline after the page loads initially.