Toolstia / Longest common substring finder

Longest common substring finder

A common substring is a run of characters that appears in both texts. Paste two texts to find the longest one, see how long it is and where it starts in each text. If several runs tie, they are all listed.

A substring is a run of characters that sit together. This tool finds the longest run that appears in both texts and shows where it starts (counting from 1). If several runs tie for longest, all of them are listed. Texts up to 5,000 characters are supported.

How it works

  1. Paste the first and second text.
  2. Choose whether to ignore case.
  3. Read the longest match and its positions.

Substring or subsequence

A substring keeps the characters together. This is different from a longest common subsequence, which may skip characters.

Positions

Positions count from 1. If a match appears several times in a text, every start is shown.

Ties

When more than one run has the longest length, each different run is listed once.

Limits

Each text can have up to 5,000 characters. Emoji and other symbols count as one character each.

Questions

Are my texts uploaded?

Everything happens in your browser, and nothing you enter is sent anywhere.

Is this the same as a diff?

No. A diff shows what changed between two versions. This tool finds the longest piece they share.

Why are there no results?

The two texts have no character in common, or you have case-sensitive matching on and they only differ in case.