Category 10 — String Search & Similarity
Find the longest shared contiguous substring or non-contiguous subsequence between two strings.
Substring (contiguous) finds consecutive shared characters, while Subsequence (non-contiguous) finds characters in order but with gaps allowed.String A and String B — results update live as you type.Results panel: it shows the match itself, its Length, both String lengths, and a Coverage percentage.Copy LCS to copy the match to your clipboard, or load a sample like AGGTAB / GXTXAYB with one click.Classic diff and three-way merge tools are built on the longest common subsequence. Computing it by hand shows the core idea those tools rely on.
A long common substring between two strings is a strong signal of shared content — useful for spotting copied code or boilerplate duplication.
DNA, RNA, and protein alignment uses longest-common-subsequence ideas. Compare sequences like AGGTAB and GXTXAYB to measure similarity.
Seeing how two versions of a string overlap helps you understand what changed, what stayed the same, and how a patch gets produced.
When two outputs share an unexpected chunk, the longest common substring pinpoints the shared region and its exact positions fast.
Everything runs in your browser. Nothing is uploaded, logged, or sent to a server — safe for sensitive strings and data.
A substring must be contiguous — characters appear back-to-back. A subsequence only needs characters to appear in the same order, with gaps allowed. For example, abc is a substring, while ace is a subsequence that skips characters.
No. Two strings can have multiple matches of the same length. The tool returns one of them deterministically — the first longest match it finds — rather than every possible one.
Both modes use dynamic programming over an m × n table, where m and n are the string lengths, running in O(m × n) time and space.
Coverage is the match length divided by the longer string's length, shown as a percentage. It's a quick measure of how much the two strings overlap.
Yes, comparison is exact and case-sensitive, so A and a are treated as different characters, and spaces count as regular characters too.
Both algorithms use an m × n table, so memory grows with the product of the two lengths. Very long strings (tens of thousands of characters) may become slow or memory-heavy.
Never. All computation happens locally in JavaScript. Your input is not sent to, stored on, or logged by any server.