ForHosting KIT · Text & AI

Longest Common Suffix Finder for Lines of Text

report-final.csv, backup-final.csv and export-final.csv share the ending -final.csv, 10 characters long, not just the .csv extension. Paste one value per line to check that filenames, paths or codes follow the same ending rule. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Text
report-final.csv backup-final.csv export-final.csv
You get
Suffix
-final.csv
Length
10
Line count
3

The longest common suffix finder compares every line you provide and returns the exact sequence of characters they all share at the end. It is useful when a list of filenames, paths, product codes, generated labels, or other strings appears to follow the same ending convention. Paste the lines as plain text and get a deterministic result with the suffix, its character length, and the number of lines examined. Nothing is guessed, reordered, or matched approximately.

Find the shared ending in a list

Put one value on each line, then run the finder. The tool starts at the final character of every line and moves backward only while all characters remain identical. The result is therefore the longest exact suffix, not merely a file extension or the last word.

For example, lines ending in <code>-final.csv</code> share that entire sequence when every preceding character differs. If one line ends only in <code>.csv</code> while another ends in <code>. CSV</code>, their letter case differs and the longer extension is not reported as a match.

This strict behavior is useful for auditing naming rules because it exposes differences that a case-insensitive search could hide. A single supplied line has that entire line as its common suffix because there are no other lines that contradict it.

Understand line endings and character matching

Windows, Unix, and older carriage-return line separators are normalized before comparison, so text copied from different operating systems behaves consistently. One final newline is treated as a text-file terminator rather than as an additional blank record. Blank lines elsewhere are preserved and participate in the calculation; because a blank line has no characters, its presence makes the shared suffix empty.

This distinction prevents an editor's ordinary final newline from destroying an otherwise useful result while still respecting meaningful empty records inside the input. Matching is performed by Unicode code point instead of by raw UTF-16 code unit. As a result, common characters outside the basic multilingual plane, including many emoji, are counted as one character in the returned length.

The comparison remains exact: accents, normalization forms, whitespace, punctuation, and letter case are not changed. If values contain trailing spaces, those spaces are genuine ending characters and affect the answer. Clean or normalize the source first when your intent is to compare semantic labels rather than their literal representation.

Use the result in validation and automation

A common suffix is a compact signal for naming consistency. In a release pipeline, compare artifact names and require an expected extension before uploading them. In a migration, inspect exported paths to see whether every item shares the same trailing directory or format marker.

In data preparation, compare identifiers to isolate a fixed check marker or vendor code that appears after a variable prefix. The capability does not infer extensions, remove whitespace, fold case, or split values on punctuation. Those choices would change the source and could produce an apparently helpful but incorrect answer.

Instead, it provides a small deterministic primitive that can be composed safely with separate cleanup or parsing steps.

Check file extensions

Confirm that a batch of filenames shares the same literal extension or a longer release suffix before processing it.

Inspect identifier conventions

Reveal a fixed trailing marker shared by product codes, ticket labels, or externally generated identifiers.

Compare exported paths

Detect a common trailing directory, filename, or format marker across paths produced by a migration.

What happens when no ending is shared?

The suffix is an empty string and the returned length is zero.

Is matching case-sensitive?

Yes. Uppercase and lowercase characters are different, and the input is compared exactly as supplied.

Does a final newline add a blank line?

No. One final newline is treated as a file terminator. Blank lines elsewhere remain part of the comparison.

How are emoji counted?

The length uses Unicode code points, so many emoji count as one character even when JavaScript stores them as two UTF-16 units.

What do I get if I paste a single line?

The whole line, because there is no other line to disagree with it. As soon as you add a second value, the result shrinks to the characters both lines share at the end.

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/common-suffix

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/common-suffix \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"report-final.csv\nbackup-final.csv\nexport-final.csv"}'
{
  "text": "report-final.csv\nbackup-final.csv\nexport-final.csv"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "str.common_suffix",
  "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_chars1000000
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.

Find the shared ending in a list

The response includes <code>suffix</code>, the number of Unicode characters in <code>length</code>, and <code>line_count</code>, so automated workflows can distinguish a real match from an empty suffix and can record how many values took part in the comparison.

Use the result in validation and automation

The API returns structured JSON, making the result easy to place in a conditional: test <code>suffix</code> against the convention you require, use <code>length</code> to remove exactly that many characters in Unicode-aware code, or log <code>line_count</code> as evidence of the checked batch. Browser use is convenient for quick checks, while API requests cost $0.002 each when the same rule needs to run repeatedly in an automated process.

What does an API request cost?

Each API request costs $0.002. The browser version can be used directly on this page.

Read the full KIT documentation →