GlyphSift
Style TextClean TextInspect UnicodeGuidesCompatibilityAll Tools
Open studio ↘
Home/Guides/How to Compare Two Lists Without Losing Original Values

Unicode guide

How to Compare Two Lists Without Losing Original Values

Comparing two lists is a set operation: you want the items unique to each list, the items they share, and sometimes the combined set. The goal is to answer which items are where without rewriting or reordering the entries you started with.

Written & reviewed by Jack Shi · Last reviewed 2026-09-20

Make it now

Generate it in three steps

  1. 1

    Open List Compare and paste your first list into List A and your second into List B.

  2. 2

    Read the four groups — only in A, only in B, in both, and the union — each with a count.

  3. 3

    Turn on case sensitivity if "Apple" and "apple" must be treated as different, then copy the group you need.

Open List Compare →
01

Set membership, not a character diff

Comparing lists asks whether a whole line appears in the other list. That is different from a character-level diff, which shows how two blocks of text differ letter by letter. For a list of names, codes, or URLs, whole-line membership is usually what you want.

A membership comparison sorts each line into a group — only in A, only in B, or in both — and can also produce the union: every distinct item across both lists, listed once.

InputA: apple, banana B: banana, cherry
GlyphSift outputOnly in A: apple · Only in B: cherry · In both: banana

Each line is matched as a whole; "banana" is shared, the others are unique.

02

Sets ignore how many times an item repeats

Set membership answers whether an item is present, not how many times it occurs. If a list contains the same line twice, a set comparison counts it once. When the repeat count matters — for example, to find duplicated rows — a duplicate-line tool that reports counts is the better fit.

Blank lines are usually noise in a list comparison and are ignored, so an empty row does not become a phantom shared item.

03

Exact matching, case, and original values

Matching is exact by default: "Apple" and "apple" are different items unless you fold case. A case-insensitive option treats them as the same, which is useful for emails or tags where case should not matter.

Throughout, the original text and first-seen order of each kept item should be preserved. The comparison decides where an item belongs; it should never change its characters, trim its spaces, or reorder it silently. Leading and trailing spaces are part of the value, so clean them first if they should not affect the match.

Try the behavior

Related tools

cleanupList Compare

Compare two line lists to find items only in A, only in B, in both, and the combined union — original values kept.

Open tool →
cleanupRemove Duplicate Lines

Keep the first occurrence of each trimmed line while preserving the original order.

Open tool →
cleanupFilter Text Lines

Keep or remove whole lines that contain a literal piece of text, with kept and removed results side by side.

Open tool →

FAQ

Frequently asked questions

How do I find items in one list but not the other?
Paste both lists into List Compare. The "Only in A" and "Only in B" groups show the items unique to each list, while "In both" shows the overlap.
Does comparing lists change my text?
No. It keeps each item's original casing, characters, and first-seen order, and only sorts items into groups. Turn on case sensitivity to treat different cases as different items.
What happens to duplicate lines within one list?
A set comparison counts a repeated line once. If you need to know how many times a line repeats, use a duplicate-line tool that reports counts instead.

Primary standards

References

  • The Unicode Standard, Version 17.0
  • Unicode Case Mapping (UAX #21 / case folding)
GlyphSiftStyle it. Clean it. Check it. Paste with confidence.
Style mapGuidesAboutAuthorContactPrivacyTermsEditorial

Independent copy-paste text tools · hello@glyphsift.com · Platform claims require evidence

Static Unicode maps target Unicode 17.0. Segmentation and normalization use the runtime's Unicode data.