Compare Python Lists Online
Paste two Python lists (as JSON arrays). See what was added, removed, or changed — element by element.
🔒 100% private — runs entirely in your browseror try sample data
Paste two Python lists (as JSON arrays). See what was added, removed, or changed — element by element.
🔒 100% private — runs entirely in your browseror try sample data
Python List Diff compares two Python lists element by element and shows you exactly what changed. Unlike Python's built-in set() difference which discards order and duplicates, this tool preserves index positions and shows additions, removals, and modifications in context.
Python lists are ordered, mutable sequences that can contain any data type — strings, numbers, nested lists, or dictionaries. When debugging data pipelines, comparing API responses, or reviewing configuration changes, seeing a visual diff of two lists is far more useful than manually scanning them.
Paste your lists as JSON arrays (e.g., [1, 2, 3]). The tool handles nested structures, mixed types, and large lists. Everything runs in your browser — your data never leaves your machine.
list_a = ["flask", "django", "requests", "numpy"]
list_b = ["flask", "fastapi", "requests", "pandas"] added = set(list_b) - set(list_a)
removed = set(list_a) - set(list_b) print(f"Added: {added}") # {'fastapi', 'pandas'}
print(f"Removed: {removed}") # {'django', 'numpy'}Set difference is fast but ignores element order and duplicate values.
list_a = [1, 2, 3, 4, 5]
list_b = [1, 2, 99, 4, 5, 6] for i in range(max(len(list_a), len(list_b))): val_a = list_a[i] if i < len(list_a) else "(missing)" val_b = list_b[i] if i < len(list_b) else "(missing)" if val_a != val_b: print(f"Index {i}: {val_a} -> {val_b}")
# Index 2: 3 -> 99
# Index 5: (missing) -> 6Manual comparison works for flat lists but breaks down with nested dicts and mixed types.
from deepdiff import DeepDiff list_a = [{"name": "Alice", "age": 30}, {"name": "Bob", "age": 25}]
list_b = [{"name": "Alice", "age": 31}, {"name": "Charlie", "age": 28}] diff = DeepDiff(list_a, list_b)
print(diff)
# {'values_changed': {"root[0]['age']": {'new_value': 31, 'old_value': 30}, ...}}DeepDiff is powerful but requires pip install. This online tool gives you the same insight instantly.
Never use a mutable list as a default function argument (def fn(items=[])). The list is shared across calls, causing unexpected diffs when comparing function outputs. Use None and create the list inside the function.
0.1 + 0.2 == 0.3 is False in Python due to floating-point precision. When comparing lists of floats, small rounding differences will show as modifications. Use round() or math.isclose() before comparing.
[1, 2, 3] == (1, 2, 3) is False in Python — lists and tuples are different types even with identical elements. When pasting data here, convert tuples to arrays: (1, 2, 3) becomes [1, 2, 3].
Paste your Python lists into the two panels using JSON array syntax (e.g., [1, 2, 3]) and click Compare. The tool highlights added, removed, and modified elements with color-coded diffs.
Yes. The tool performs deep comparison of nested lists, dictionaries, and mixed structures at any depth. Nested changes are shown with path-based highlighting.
A set difference (set(a) - set(b)) only tells you which elements exist in one set but not another, discarding order and duplicates. A list diff preserves index positions and shows exactly which elements changed at each position.
Yes. This tool runs entirely in your browser using client-side JavaScript. Your data is never sent to any server, making it safe for comparing sensitive data.
Yes. Convert Python dicts to JSON objects (they use the same {"key": "value"} syntax). The tool compares them structurally at any nesting depth.
Yes. Check the "Ignore array order" option to compare lists as unordered collections, similar to comparing Python sets but with support for duplicates and nested structures.