# Compare lists and text

Compare two lists line by line: find what is in both, only in one, or in either, or see a marked line diff side by side.

https://codeknife.dev/en/compare-lists/

## What it does

Compares two lists line by line. As sets: every line once (union), the lines in both lists (intersection), the lines only in A or only in B, and the lines in exactly one of the two. As text: a line diff that marks each line as unchanged, removed or added, in a unified view or side by side.

## How to use it

1. Type or paste one item per line into **List A** and **List B**. A text file can be dropped into list A.
2. Pick an operation. Under More, turn off **Case sensitive** so `Apple` and `apple` count as equal, or turn on **Ignore surrounding whitespace** so a trailing space does not make a line different. The result keeps the lines as you typed them.
3. Copy or download the result. **Remove blank lines** drops empty lines from both lists first.

## Examples

With list A holding `a, b, c, d` and list B holding `b, c`:

**A − B** gives `a` and `d`, **A ∩ B** gives `b` and `c`, and the **Line diff** marks `a` and `d` as removed from A.

## Good to know

- Set operations ignore the order of the lines and give each line once, in the order it first appears.
- A line diff compares the lists from top to bottom, so a line that moved shows up as removed in one place and added in another.
- In the side-by-side view, lines that changed share a row; a line with no partner has a blank side.
- Lines that differ only in what you chose to ignore count as equal and are shown as in list B.

## What do the operations mean?

A ∪ B lists every line that is in either list, once. A ∩ B keeps the lines in both. A − B keeps the lines only in A, and B − A the lines only in B. The last set operation keeps the lines that are in exactly one list. Each result is free of repeats and stays in the order of its first appearance.

## Frequently asked questions

### What is the difference between a set operation and a line diff?

A set operation compares the lists as collections, so the order of the lines does not matter. A line diff compares them as text from top to bottom and marks each line as unchanged, removed or added, like a code review would.

### Can I ignore case and spaces?

Yes. Under More, turn off case sensitivity and turn on ignoring surrounding whitespace. Lines that differ only in that way count as equal, and the result keeps them as you typed them.

### Does this tool send my lists anywhere?

No. Everything happens in your browser. What you type is never sent to our servers.