Built to order

Text Diff and Merge Tool with Side-by-Side View

This project builds a browser-based text diff and merge tool that compares two versions of any text — source code, config files, changelogs — showing exactly what changed, line by line and word by word. Split side-by-side and unified views are included, and every changed block can be merged individually by keeping the original, the revised, or both versions. The whole tool is a single HTML file that runs locally with no backend, so pasted text never leaves the machine and it works offline. Suitable for B.E./B.Tech final-year projects in Computer Science and IT.

Text Diff and Merge Tool with Side-by-Side View — project thumbnail preview
More project photos (2)

The problem

Comparing two versions of a file is a daily task in software work: reviewing a pull request, auditing a config change before deployment, or reconciling two edited copies of a document. Plain text editors cannot show what changed between versions, and while command-line diff exists, its output is hard to read for students and its merge workflows are intimidating. This project builds a visual diff and merge tool that runs entirely in the browser: paste two texts (or load the included sample pairs — a Python service config across two releases, an nginx staging-vs-production config, or a changelog), and the tool computes a line-level diff with word-level highlighting of exactly which tokens changed. A split side-by-side view aligns both versions row by row; a unified view shows a single-column +/- listing with collapsible unchanged regions. Each changed block becomes a merge card where you keep the original, keep the revised, or take both, and the merged preview updates live. The whole tool is one self-contained HTML file with no server, so it runs offline and demonstrates a complete string-algorithms application.

How it works

  1. You paste the original text into the left editor and the revised text into the right editor (or pick one of the three sample pairs); the diff recomputes live as you type.
  2. The engine runs a line-level longest-common-subsequence comparison on the two line arrays (with optional whitespace/case normalization) and groups the result into equal runs and changed blocks.
  3. For each changed block, a word-level comparison on paired lines marks exactly which tokens were added, removed or altered, rendered as inline highlights.
  4. In split view the block's lines are row-aligned (the shorter side padded with blanks); in unified view the block is shown as -/+ lines with an @@ header and long unchanged runs collapsed behind a click-to-expand gap row.
  5. Switching to the merge tab turns every changed block into a conflict card; clicking keep-original / keep-revised / take-both records the resolution for that block.
  6. The merged output is assembled from unchanged lines plus each block's chosen content (unresolved blocks get standard conflict markers) and can be copied or downloaded.

Tech stack:

  • HTML5, CSS3 (single-file app, no build step)
  • Vanilla JavaScript (diff engine, merge state, live rendering)
  • LCS-based line diff with word/token-level refinement
  • Browser Clipboard API + Blob download (result export)
  • Chromium/any modern browser (runs fully offline)
Parameter Value
App format Single self-contained HTML file (no backend, no dependencies)
Diff algorithm Line-level longest common subsequence + word-level refinement
Views Split side-by-side, unified +/-, merge/conflict resolution
Merge actions per block Keep original / keep revised / take both
Unresolved blocks Standard <<<<<<< / ======= / >>>>>>> conflict markers
Compare options Ignore whitespace, ignore case, context 3/5/10/all
Sample pairs included 3 (Python config, nginx config, changelog)
Export Copy to clipboard, download merged result as .txt
Runtime Any modern browser; works offline after download (expected)

Project features

  • [Split side-by-side diff view] The two versions are shown in aligned columns with per-line numbering, changed blocks grouped with headers, and word-level highlighting so you see exactly which tokens differ inside a modified line.
  • [Unified +/- view] A single-column diff with -/+ markers and @@ block headers, collapsible unchanged regions with adjustable context lines (3, 5, 10 or all), and the same word-level highlighting.
  • [Block-by-block merge] Every changed block becomes a conflict card with three resolution actions — keep original, keep revised, or take both — and a badge showing whether the block is resolved.
  • [Live merged-output preview] The merged result recomputes on every resolution; unresolved blocks render with standard <<<<<<</=======/>>>>>>> conflict markers, and the result can be copied to the clipboard or downloaded as a .txt file.
  • [Compare options] Ignore-whitespace and ignore-case modes change the comparison semantics, useful for diffing reformatted code or case-insensitive text.
  • [Live diff statistics] Additions, deletions, unchanged lines and changed-block counts update as you type, giving an instant summary of how much actually changed.
  • [Three realistic sample pairs] Preloaded comparisons — a Python service config across two releases, an nginx staging-vs-production config, and a changelog — so the tool is demonstrable in seconds.
  • [Fully offline single file] The entire app, including the diff engine and UI, is one HTML file with no backend and no build step — it opens in any modern browser.

What is included

  • Single-file diff and merge web app (DiffLens) with all three views
  • Diff engine source (line LCS + word-level highlighting) with comments
  • Three realistic sample file pairs for demonstration
  • Project report PDF (background, diff-algorithm explanation, methodology, usage guide)
  • PPT presentation for final review
  • Viva Q&A preparation document (diff algorithms, LCS complexity, merge strategies, conflict markers)

Limitations & prerequisites

  • The comparison is text-based: it diffs lines and words, not syntax trees, so moved code blocks appear as delete+insert rather than "moved".
  • Very large files (tens of thousands of lines) will feel slow because the LCS table is O(n*m) memory — the tool is designed for config/code files of a few hundred lines, typical of student use.
  • Three-way merge (common ancestor + two branches) is out of scope; the tool merges two versions pairwise.
  • Merge resolution is manual per block — there is no automatic conflict resolution or AI suggestion.
  • The app compares text only; binary files, images and formatted documents are not supported.

Frequently Asked Questions

How does the diff actually work?

The engine compares the two texts line by line using a longest-common-subsequence algorithm, then groups the differences into changed blocks. Inside each block, paired lines get a word-level comparison so exactly the changed tokens are highlighted, not just the whole line.

What is the difference between the split and unified views?

Split view shows both versions in aligned side-by-side columns with line numbers — best for reading two code versions together. Unified view shows one column with - and + markers like classic patch output, with long unchanged stretches collapsed — best for scanning many small changes quickly.

How does merging work?

Each changed block becomes a conflict card. You resolve it by keeping the original version, keeping the revised version, or taking both. The merged preview updates live; any block you skip appears with standard conflict markers (<<<<<<< / ======= / >>>>>>>), which you can copy out and resolve elsewhere.

Does it need a server or internet connection?

No. The entire app is one HTML file — the diff engine, merge logic and UI all run in the browser. It works fully offline once downloaded, which also means pasted text never leaves your machine.

Can it compare files, or only pasted text?

The demo compares text pasted into the two editors (or the included samples). Extending it to file upload via the FileReader API is listed as future scope in the report.

Is this project suitable for a final-year project?

Yes — for Computer Science and IT programs. It demonstrates string algorithms (LCS), real UI engineering, and a genuinely useful developer tool with a working demo. Suitable for B.E./B.Tech final-year projects in Computer Science and IT.

Components & software requirements
  • HTML5, CSS3 (single-file app, no build step)
  • Vanilla JavaScript (diff engine, merge state, live rendering)
  • LCS-based line diff with word/token-level refinement
  • Browser Clipboard API + Blob download (result export)
  • Chromium/any modern browser (runs fully offline)
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download abstract (PDF)

Related guides

All guides
Illustration of JWT authentication: a brass key handing a glowing sealed token to a server rack and a laptop login screen, linked by a chain motif.B.E./B.Tech Computer Science and IT students adding login and protected APIs to their final-year web projects

JWT Authentication for Students: Tokens, Signatures, Refresh Flows and a Node.js Implementation

How does JWT login actually work? When a user logs in, the server issues a signed token in three parts — header, payload, signature. The client sends it back as an Authorization: Bearer header, and the server verifies the signature instead of looking up a session. This guide decodes a real token by hand, walks through the full login and refresh flow, and builds a working Node.js implementation with bcrypt password hashing, token rotation, and storage rules that survive a viva.

Read guide
Illustration of SQL versus NoSQL: neat filing-cabinet table rows on one side against flexible nested document cards on the other, joined by dotted lines.B.E./B.Tech Computer Science and IT students choosing and designing the database for their final-year project

SQL vs NoSQL for Final-Year Projects: Which Database Should You Pick?

MySQL or MongoDB for your final-year project? SQL databases store data in related tables with enforced schemas, joins and transactions — the right default when your data is structured and money or records must stay consistent. NoSQL document stores trade the rigid schema for flexible, nested documents that ship faster when your data shape keeps changing. This guide compares them with a worked hospital-appointment example in both, a decision table, and rules matched to common project archetypes.

Read guide
Editorial illustration of shipping containers transforming into glowing software windows beside a laptop showing container layers, in blue and teal tones.B.E./B.Tech Computer Science and IT final-year students shipping web/backend projects

Docker for Student Projects: Images, Containers and Compose from Zero

End ‘it works on my machine’ failures: learn what Docker images and containers actually are, write lean Dockerfiles that exploit layer caching, persist data with volumes, orchestrate app-plus-database with Compose, and package an evaluator-proof submission — with the debugging table for every error you will definitely meet.

Read guide
Get a quotation