ForHosting KIT · Developer Utilities

Line Diff Checker

The Line Diff Checker compares an original text with a revised text and presents the result in reading order.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Every line is marked as added, removed, or unchanged, with its applicable line number from each version. It is designed for reviewing edits, checking generated files, validating configuration changes, and understanding exactly how one version differs from another. The comparison is deterministic, runs without network access, and treats Windows, classic Mac, and Unix line endings consistently.

Prepare the two versions for a useful comparison

Place the earlier version in the original text field and the later version in the revised text field. The checker compares complete lines, so punctuation, capitalization, spacing, and every other character within a line matter. A line containing one changed character is represented as one removed line followed by one added line. This deliberate behavior keeps the result faithful to a line-oriented review instead of implying that two different lines are unchanged. Line endings are normalized before comparison, which means text copied from Windows, Unix, or older Mac files can be compared without false differences caused only by carriage-return conventions. Blank lines inside a document remain meaningful and can appear as added, removed, or unchanged entries. If a document ends with a newline, the resulting final empty line is also part of the comparison. For the clearest review, avoid changing unrelated formatting at the same time as substantive content, because broad reformatting naturally produces a larger diff even when the underlying ideas remain similar.

Read statuses, line numbers, and the summary

The result follows the order needed to reconstruct the change from the original version to the revised version. An unchanged entry includes both the old and new line numbers because that exact line exists in both texts. A removed entry includes only its old line number, while an added entry includes only its new line number. These omitted fields are intentional: an added line has no location in the old document, and a removed line has no location in the new document. The summary counts provide a quick measure of the edit, while the detailed line array provides the evidence behind those totals. The identical flag is true only when there are no additions or removals. Repeated lines can sometimes be aligned in more than one mathematically valid way. To keep output stable, the checker uses a fixed tie-breaking rule and prefers a removal when two alignments preserve the same number of unchanged lines. The same inputs therefore always produce the same sequence, making the result suitable for tests and automated review workflows.

Use the diff safely in reviews and automation

A line diff is especially useful when structure matters: source files, configuration, release notes, lists, policies, prompts, and exported records are common examples. In a human review, begin with the summary and then inspect every removed and added pair in context. In automation, check the identical flag for a fast decision and retain the detailed entries when an audit trail or explanatory report is required. The checker does not judge whether an edit is correct, merge competing changes, or calculate a semantic similarity score. It reports exact textual relationships so that a person or another deterministic rule can make that decision. Both inputs are bounded to protect predictable execution, and comparisons happen entirely in memory without contacting external services. API use costs $0.002 per request. When processing many files, compare them one pair at a time and preserve their filenames or version identifiers in your own workflow, because this capability receives text rather than repository metadata. For sensitive material, follow the retention and transport requirements of the channel through which you submit the request.

Review configuration edits

Compare old and proposed configuration text to see every exact line that an update inserts or removes.

Validate generated output

Check a newly generated manifest, report, or code fragment against a known expected version in an automated workflow.

Explain document revisions

Create a structured change record for policies, release notes, instructions, or other line-oriented documents.

What does each status mean?

Unchanged means the exact line appears in the selected alignment of both versions. Removed means it exists only in the original alignment, and added means it exists only in the revised alignment.

Does it compare words inside a changed line?

No. This is intentionally a line-level diff. A changed line appears as a removal and an addition, preserving an exact and unambiguous record.

Are different line-ending formats treated as changes?

No. Windows, Unix, and classic Mac line endings are normalized before the lines are compared.

How are repeated identical lines aligned?

The algorithm preserves a longest common sequence of lines and applies a stable tie-break that prefers a removal when equivalent alignments exist.

Can I use the output in automated tests?

Yes. The algorithm has no network calls, randomness, or time-dependent values, so identical inputs always produce identical JSON output.

What does an API request cost?

Each API request costs $0.002. The browser version can run the same deterministic comparison locally.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/str/diff-lines

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/str/diff-lines \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"before_text":"Apples\nBananas\nCherries","after_text":"Apples\nBlueberries\nCherries"}'
{
  "before_text": "Apples\nBananas\nCherries",
  "after_text": "Apples\nBlueberries\nCherries"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "str.diff_lines",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_chars_per_text200000
max_lines_per_text1000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →