Find Common Lines

Paste two lists to pull out every line found in both. Each match shows where it sits in each list, so you check a result in seconds. Your text stays in your browser.

Shared lines appear here once both boxes hold text.

What Load sample shows

Load sample fills both boxes with top pages from two months on toolexe.com, pasted the way a messy export arrives. List A holds 8 lines and 7 distinct URLs. List B holds 9 lines and 8 distinct URLs. Four URLs land in the table.

Two of those four only match because of the default settings. List B spells one URL /JSON/Viewer in capitals and pads the beautifier URL with three trailing spaces. Untick Ignore case and the shared count falls to three. Untick Trim line edges and the beautifier row goes too. The table prints the List B spelling in orange under a line when capitals or inner spacing differ, so you see what the settings forgave.

The word counter URL sits on lines 2 and 7 of List A and lines 6 and 9 of List B. It takes one row with both positions. Tick Keep repeats and your copy holds it twice, for five lines in total.

How two lines count as a match

Matching runs on whole lines. Order plays no part, so line 40 of List A pairs with line 2 of List B. The Default column shows the result with the settings as the page loads.

List AList BDefaultWhat changes the result
Order 4417order 4417MatchUntick Ignore case
Order 4417Order 4417   with trailing spacesMatchUntick Trim line edges
Order 4417Order  4417 with two inner spacesNo matchTick Collapse inner spaces
café as one charactercafé as e plus an accentMatchAlways on, both reduce to one Unicode form
Order 4417Order 4417,No matchNo setting. Strip the comma first
straßeSTRASSENo matchNo setting. Ignore case compares lowercase forms, and the two stay different

Two lines look identical and still fail? Suspect a hidden character. Text from Word, PDFs and web pages often carries a no-break space inside the line or a zero-width space. Paste the line into the Character Frequency Counter and the table names the culprit. A Windows line ending and a byte order mark at the top of a file cause no trouble here, since both get removed before matching.

The same job in a terminal or a spreadsheet

Scripted work belongs in a script. Each method below gives a slightly different answer, and the gap decides which one fits. We ran comm, grep and uniq against the sample lists with no cleanup. All three missed the viewer and beautifier URLs, the same two the default settings here rescue.

WhereCommandWatch for
Bashcomm -12 <(sort a.txt) <(sort b.txt)Both inputs need the same sort order. A line repeated in both files prints as many times as the smaller count.
Grepgrep -Fxf a.txt b.txtNo sorting needed. Prints every match in List B order, repeats included. Add -i to ignore case.
Bashsort a.txt b.txt | uniq -dShort and wrong for repeats. A line entered twice in one file reports as shared even when the other file lacks it. Dedupe each file first.
PowerShellCompare-Object (gc a.txt) (gc b.txt) -IncludeEqual -ExcludeDifferentIgnores case by default. Add -CaseSensitive to keep case.
Pythonset(a) & set(b)Drops order and repeats. Strip each line first, or a final line with no newline misses its match.
Excel 365=FILTER(A2:A200,COUNTIF(B2:B200,A2:A200))COUNTIF ignores case and treats * and ? as wildcards, so a line holding either returns false matches.
SQLSELECT email FROM a INTERSECT SELECT email FROM bReturns distinct rows. Case handling follows the column collation.

Jobs where two lists meet

Mailing list overlap

Paste two exported address columns to see who signed up twice. Keep Ignore case on, because signup forms store capitals as typed. Gmail ignores dots in an address and this page does not, so a dotted and an undotted version stay separate rows.

Pages in two Search Console exports

Compare two periods and keep the URLs ranking in both. Check protocol and trailing slashes first. A page exported with a slash in one file and without in the other counts as two lines.

Shared packages between projects

Run pip freeze in each project. Full lines compare exact versions, so requests==2.32.3 and requests==2.31.0 miss. Cut everything after the package name to compare names instead.

Errors in two log files

A timestamp makes every log line unique, so a raw compare returns nothing. Remove the date column first, then the table shows errors present on both days, and the line numbers take you back to each file.

Where this tool stops

Pick the right line tool

Your questionUse
Which lines appear in both lists?This page
Which lines appear in one list and not the other?Find Unique Lines
How similar are the two blocks overall?Text Line Comparison
What changed between two versions of a document?Text Difference Checker, because position matters there
Which lines repeat inside one list?Duplicate Line Remover

Find Common Lines FAQ

How do I find common lines between two text files?

Press Open .txt under each box and pick a file. The shared lines appear as soon as both boxes hold text. Press Download .txt to save the result as common-lines.txt.

Does line order matter?

No. A line matches wherever it sits in the other list. The Lines in A and Lines in B columns show each position, and the Sort menu reorders the table without changing the matches.

Which spelling does the result use when case differs?

The result keeps the first spelling from List A. Press the swap button to take List B spelling instead. Your capitals stay intact either way, so IDs and codes survive the copy.

How does the tool handle a line repeated in one list?

A repeated line takes one row, with every position listed. Tick Keep repeats and the copy holds the line as many times as the lower of the two counts, the same behavior as the comm command.

Why do two lines that look the same fail to match?

A hidden character sits in one of them, most often a no-break space or a zero-width space from a web page or PDF. Collapse inner spaces fixes the no-break space. A zero-width space needs removing by hand.

Are my lists uploaded anywhere?

No. Matching runs in your browser, and the text never reaches a server. Copy page link shares the empty tool, so your lists stay out of the address.