Compare Two Lists
Drop two lists into the List A and List B boxes, one item per line, and instantly see four groups: what is only in A, only in B, shared by both, and the combined union. Each group shows a live count and a copy button, so you can lift a slice straight into a spreadsheet or script. Matching updates as you type, and duplicates and blank lines are cleaned up before the compare.
How to compare two lists
- Paste your first list into the List A box, one item per line.
- Paste your second list into the List B box.
- Tick 'Ignore case' if 'Apple' and 'apple' should count as the same item.
- Leave 'Trim each line' on to drop leading and trailing spaces before matching.
- Read the four result groups and use the copy button on any of them.
Examples
Find shared and unique items
List A: apple, banana, cherry (one per line) List B: banana, cherry, date (one per line)
Only in A (1): apple. Only in B (1): date. In both (2): banana, cherry. Union (4): apple, banana, cherry, date.
Match while ignoring case
List A: Apple, apple, Banana List B: APPLE, cherry, with 'Ignore case' on
Only in A (1): Banana. Only in B (1): cherry. In both (1): Apple. Union (3): Apple, Banana, cherry.
Collapse duplicates within a list
List A: red, red, green, blue List B: green, yellow
Only in A (2): red, blue. Only in B (1): yellow. In both (1): green. Union (4): red, green, blue, yellow.
Frequently asked questions
How are items separated?
By line. Put one item per line in each box. Blank lines are ignored, and surrounding whitespace is trimmed by default so a stray space does not make two otherwise identical items look different.
Can I match while ignoring case?
Yes. Tick 'Ignore case' so 'Apple' and 'apple' count as the same item. The result keeps the original casing from the first time an item appears, so the output stays readable.
What happens to duplicate items in one list?
Duplicates within a single list are collapsed to one entry before comparing, and the first occurrence wins. That means each item is counted once and the counts shown next to each group reflect distinct items.
What does the union show?
The union is every distinct item across both lists combined. It lists List A's items first, in their original order, followed by any items that appear only in List B.
Is the original order preserved?
Yes. Items keep the order they first appear in. 'Only in A' and 'In both' follow List A's order, 'Only in B' follows List B's order, and the union chains A then B's new items.
What is the difference between 'In both' and an intersection?
They are the same thing. 'In both' is the set intersection, the items that appear in List A and also in List B, and 'Only in A' plus 'Only in B' is the symmetric difference.
Can I compare thousands of lines?
Yes. The compare runs in your browser using hash sets, so even large lists resolve quickly. The practical ceiling is your device memory rather than a fixed row limit.
Is there an API?
Yes. This tool exposes a JSON endpoint that accepts listA and listB strings plus optional caseInsensitive and trim flags, and returns onlyA, onlyB, both, and union arrays.
Is my data private?
Yes when you use the tool in the browser. The comparison happens locally and nothing is uploaded, so pasted lists never leave your device.
Learn more
- Set operations behind comparing two lists
Union, intersection, and difference in plain terms, plus why de-duplication and case handling change which items land in each group.
Related tools
CSV to Markdown
Convert CSV data into a clean GitHub-flavored Markdown table. Handles quoted fields, commas, and pipes, with column alignment. Free, fast and private.
Remove Line Breaks
Remove line breaks and paragraph breaks from text online. Flatten copied text into one line, keep spaces tidy, then copy the result. Free and private.
.env to JSON
Convert a .env file to JSON, or JSON back to .env. Parses KEY=value lines, comments, quotes and export. Runs entirely in your browser.
ASCII Table
Full ASCII table for all 128 codes with decimal, hex, octal and binary values, character names and descriptions. Search by code, hex or character.
Aspect Ratio Box Generator
Generate CSS for a responsive aspect-ratio container. Use the modern aspect-ratio property or the padding-top fallback, then copy the ready code.
Aspect Ratio Calculator
Calculate aspect ratios fast. Enter a ratio like 16:9 and one dimension to get the other, or enter width and height to simplify the ratio.