← Voltar ao portfólio

Text diff

Compare versions side by side with simple per-line highlighting.

A

{{ line.text }}

B

{{ line.text }}

Overview

`diff` is one of the oldest and most essential Unix utilities — it was created in 1974 by Doug McIlroy at Bell Labs, the same laboratory that gave birth to Unix, the C language, and AWK. The idea seemed simple: given two text files, show exactly what changed between them. Under the hood, the algorithm uses LCS (Longest Common Subsequence) to find the shared lines and deduce what was added, removed, or modified. That algorithm has O(n*m) complexity in the worst case and was the subject of refinements like the Myers algorithm (1986), which is what Git uses to this day.

`diff` became synonymous with version control. When you run `git diff`, `git log -p`, or review a pull request on GitHub, what you see is essentially the output format of classic `diff` — removed lines in red with `-`, added lines in green with `+`, and surrounding context to help locate the changes. The code Git uses to calculate text diffs is fundamentally the same 1974 algorithm, with optimizations. Tools like `vimdiff`, `meld`, and `Beyond Compare`, and the PR views on GitHub and GitLab exist because comparing text across versions is a core need in modern software development.

`diff` is also enormously useful outside of code. Comparing two configuration files (`.env.example` vs `.env.local`), checking whether a JSON API response changed between deployments, verifying that a SQL migration matches what was approved in review, comparing two versions of a contract or legal document — all of these are real-world diff use cases in an engineering team's daily workflow. Visual regression testing tools like Percy and Chromatic essentially run a diff of images between versions. The principle is the same: identify what changed.

This tool performs a line-by-line comparison between two texts you paste into the left and right panels, visually highlighting the differences. It is not a binary diff or a three-way merge like what Git uses in merge conflicts. For larger file comparisons with full context and hunk navigation, use dedicated tools like `diff` in the terminal, `git diff`, or applications like `meld`. For quick checks — verifying whether two JSONs have the same structure, comparing outputs of two API calls, reviewing changes between text drafts — this tool works without installing anything.

How to use this tool in a real workflow

Recommended step by step

  1. Start with a small, representative sample in Text diff before processing the complete material. This keeps errors visible and makes the result easier to audit.
  2. Use the output to document workflows, validate examples, prepare content operations, and reduce repetitive manual editing.
  3. Before publishing or shipping, compare the result with the original goal and check names, formats, sensitive data, and edge cases.

Practical tips

  • Keep the original input nearby so you can reverse or explain every transformation.
  • Remove credentials, private identifiers, and personal data before sharing examples publicly.
  • Combine tool output with human review when the result affects documentation, production code, or editorial quality.

Quality criteria

Criterion Reference Why it matters
Operational privacy Local processing when applicable Reduces exposure of drafts, payloads, and working text.
Recommended review Always before publishing Tools speed up execution; context and intent remain human.
Workflow gain Minutes per repetitive task Standardization reduces rework in docs, QA, and editing.

Related tools

Technical deep dive

Common questions summarized

  • What is this tool for?: It runs fully in your browser: useful to validate, format, or convert data in everyday development.
  • Are my inputs sent to a server?: Processing happens locally with JavaScript. We do not store what you paste into the text areas.
  • Can I use this for real production data?: Use at your own risk. For secrets (passwords, tokens), prefer controlled environments and your company policies. And always review the generated contents. Never trust blindly things you see on the internet.

Sample payload to try

  • See also the larger "Code Snippets" sample; paste this excerpt to try locally: Scenario — Compare .env.example vs .env local (sem subir segredos).

Tool guide

  • What you are working with Two text versions (files, configs, log snippets).

  • What the tool does Compares line by line with simple highlighting.

  • Why use it Review .env, error messages, small patches before commit. Not a binary diff or merge engine.

Code Snippets

Code example
Compare .env.example vs .env local (sem subir segredos).

Scenario

Compare .env.example vs .env local (sem subir segredos).

FAQ

What is this tool for?

It runs fully in your browser: useful to validate, format, or convert data in everyday development.

Are my inputs sent to a server?

Processing happens locally with JavaScript. We do not store what you paste into the text areas.

Can I use this for real production data?

Use at your own risk. For secrets (passwords, tokens), prefer controlled environments and your company policies. And always review the generated contents. Never trust blindly things you see on the internet.