Skip to content
UniKit

Text set operations

Compare two text blocks line by line: intersection, union, difference (A−B / B−A), symmetric difference and deduplicated merge — with optional case/whitespace folding, sorting and per-set counts.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Comparison is line based; folding case/whitespace only decides whether two lines count as the same item — the original spelling of the first occurrence is kept.

Counts

Lines in A: 4Lines in B: 4

Results

Intersection (A ∩ B)

2
banana
date

Union (A ∪ B)

6
apple
banana
cherry
date
elderberry
fig

Difference (A − B)

2
apple
cherry

Difference (B − A)

2
elderberry
fig

Symmetric difference (A ⊕ B)

4
apple
cherry
elderberry
fig

Deduplicated merge

6
apple
banana
cherry
date
elderberry
fig

What this tool does

  • Run real set operations on two lists: what both sides share (intersection), what only one side has (difference) and everything merged and deduplicated (union).
  • Reconcile keywords, allow-lists, mailing lists or product SKUs between two versions and see instantly what was added and what was dropped.
  • Compare with case and whitespace folding so "Apple" and "apple " are not treated as two different items.
  • Sort the results when you want them ordered, then copy them straight into a spreadsheet or a ticket.

Example

Input

A:
apple
banana
cherry
date

B:
banana
DATE
elderberry
fig

Output

Intersection: banana
date

Difference A−B: apple
cherry

Difference B−A: elderberry
fig

Symmetric difference: apple
cherry
elderberry
fig

With "ignore case" enabled, DATE and date count as the same item, but the output keeps the spelling of the first occurrence (date).

Frequently asked questions

Do two words that differ only in case count as the same item?

Not by default — enable "ignore case" and they do. Folding case or whitespace only decides whether two lines count as the same item; the output still keeps the original spelling of the first occurrence.

Are duplicate lines kept in the results?

No. Comparison is line based and set based: an item that appears several times on one side is kept once, in the spelling of its first occurrence. To simply deduplicate one list, choose "deduplicated merge" and leave B empty.

What does an empty intersection mean?

That no line is identical on both sides under the current options. Check for blank lines, trailing spaces and case differences, then turn on "ignore whitespace" and "ignore case" and compare again.

How much text can I compare?

Up to 20000 lines per side. Anything larger is rejected instead of freezing the page, because the comparison runs on the browser main thread and very large inputs would make the tab unresponsive.

Keywords:set集合交集并集差集对称差去重intersectionuniondifferencededuplicate

Related tools