Tri Differ is a browser-based .docx comparison tool. It loads multiple Word documents, renders Word-like pages, compares text and embedded images, and builds a navigable similarity index. All document processing happens locally in the browser.
- Load any number of
.docxfiles in one session. - Organize comparisons as independent tasks, each with its own A/B document windows.
- Select an A/B window and double-click a file in the document library to open it in that window.
- Collapse either sidebar to give more space to the document panes.
- Render only the active task's two full Word-like document views instead of rendering every loaded file.
- Preserve page size, margins, paragraph alignment, indentation, line spacing, basic text formatting, tables, and inline image placement as closely as practical in a browser.
- Generate text similarity matches sorted by score.
- Detect identical and visually similar embedded images using file digests and 64-bit dHash fingerprints.
- Reduce comparison work with text candidate indexing and image hash buckets instead of comparing every possible pair.
- Filter the match index to the active A/B document pair.
- Jump to and highlight both matching locations by selecting an index entry.
- Adjust the text similarity threshold, image hash-distance tolerance, and page zoom.
- Export the similarity index as JSON.
- Keep documents private: no upload or server-side conversion is required.
No build step or application installation is required.
- Clone or download this repository.
- Open
index.htmlin a modern desktop browser.
git clone git@github.com:jameswibe79/tri_differ.git
cd tri_differ
python3 -m http.server 8000Then open:
http://localhost:8000
A local server is useful when a browser applies stricter permissions to pages opened with the file:// protocol.
- Click Add Word and select one or more
.docxfiles. - Wait for automatic analysis, or click Compare.
- Select a task and then select its A or B window in the left sidebar.
- Double-click a document in the file library to open it in the selected window.
- Review the similarity index in the right sidebar. The index follows the active A/B pair.
- Select a text or image match to jump to and highlight both corresponding locations.
- Adjust the text threshold or image tolerance when needed.
- Use Export to save the generated index as JSON.
A .docx file is a ZIP archive. Tri Differ uses the bundled vendor/jszip.min.js to read:
word/document.xml- page and margin settings
- paragraph and table structures
- document relationships
- embedded files under
word/media/
The application reconstructs an approximate Word-style page layout directly in the browser. It does not require Microsoft Word, LibreOffice, a backend service, or a document-conversion server.
Text comparison uses indexed candidate generation to avoid an exhaustive comparison of every sentence pair. Image comparison combines exact file digests with 64-bit difference hashes, making it possible to find both identical images and images that remain visually similar after scaling or light recompression.
Documents stay in the current browser session. The application does not upload files or document contents to a remote service. Closing or refreshing the page clears the in-memory session unless the browser itself retains page state.
Use a current desktop browser with support for:
- File API and
ArrayBuffer DOMParser- Web Crypto
- Canvas
- modern JavaScript and CSS
Chromium-based browsers are used by the smoke test.
- Only
.docxdocuments are supported. - Browser rendering approximates Microsoft Word layout and is not a pixel-perfect replacement for Word's rendering engine.
- Advanced Word features may not be represented exactly.
- Rich image formats that a browser cannot draw may still be detected as exact binary matches, but perceptual comparison may be unavailable.
- Analysis performance depends on document size, sentence count, embedded image count, and the selected thresholds.
tri_differ/
├── index.html
├── README.md
├── README.zh-CN.md
├── src/
│ ├── app.js
│ └── styles.css
├── tests/
│ ├── create-fixtures.py
│ └── smoke.js
└── vendor/
└── jszip.min.js
Basic syntax and browser smoke checks:
python3 tests/create-fixtures.py
node --check src/app.js
node --check tests/smoke.js
node tests/smoke.jsThe browser smoke test requires Playwright and a Chrome-compatible browser. If Playwright is not already available:
npm install --no-save playwright
npx playwright install chromeThe fixture generator writes temporary test documents under /tmp/tri_differ_smoke.