Find Missing Elements in Arrays
Paste an expected array and an actual array to instantly spot gaps, missing records, and absent elements.
🔒 100% private — runs entirely in your browseror try sample data
Paste an expected array and an actual array to instantly spot gaps, missing records, and absent elements.
🔒 100% private — runs entirely in your browseror try sample data
Finding missing elements between two arrays is the process of identifying items that exist in one collection but are absent from another. This is equivalent to computing the set difference (A \ B) — the elements in A that do not appear in B. This tool makes that comparison visual: paste your expected list and your actual list, and instantly see what is missing, what was added, and what remains unchanged.
Missing element detection is essential in data integrity workflows. When migrating database tables, you need to verify that every record from the source system arrived in the destination. When syncing inventory between systems, gaps in the product list mean lost sales. When validating test coverage, comparing a list of expected test cases against actually-executed tests reveals untested paths. In each scenario, the question is the same: what should be here but is not?
Paste your arrays as JSON (e.g., [1, 2, 3, 4, 5]). Put the expected or reference array in the first panel and the actual or target array in the second. Elements shown in red are missing from the second array. Elements in green are extra items found in the second array but not in the first. All processing happens client-side — your data stays in your browser.
const expected = ["users", "orders", "products", "categories", "reviews"];
const actual = ["users", "orders", "products", "reviews"]; // Elements in expected but missing from actual
const actualSet = new Set(actual);
const missing = expected.filter(item => !actualSet.has(item));
console.log(missing); // ["categories"] // Elements in actual but not in expected (extras)
const expectedSet = new Set(expected);
const extras = actual.filter(item => !expectedSet.has(item));
console.log(extras); // [] // Full symmetric difference
const diff = [ ...missing.map(m => ({ value: m, status: "missing" })), ...extras.map(e => ({ value: e, status: "extra" }))
];
console.log(diff);
// [{value: "categories", status: "missing"}]Using Set for the lookup array makes difference computation O(n+m) instead of O(n*m). This matters when comparing arrays with thousands of elements.
expected = ["users", "orders", "products", "categories", "reviews"]
actual = ["users", "orders", "products", "reviews"] # Missing from actual (set difference)
missing = set(expected) - set(actual)
print(missing) # {'categories'} # Extra in actual (reverse difference)
extras = set(actual) - set(expected)
print(extras) # set() # Preserve original order
missing_ordered = [x for x in expected if x not in set(actual)]
print(missing_ordered) # ['categories'] # For arrays with duplicates, use Counter
from collections import Counter
expected_counts = Counter(expected)
actual_counts = Counter(actual)
missing_with_counts = expected_counts - actual_counts
print(dict(missing_with_counts)) # {'categories': 1}Python's - operator on sets gives you the difference directly. Use Counter subtraction when duplicate counts matter — it tells you not just which elements are missing but how many copies are missing.
-- SQL EXCEPT: find rows in table_a not present in table_b
SELECT name FROM expected_tables
EXCEPT
SELECT name FROM actual_tables;
-- Returns: 'categories' -- LEFT JOIN approach (works in all SQL dialects)
SELECT a.name
FROM expected_tables a
LEFT JOIN actual_tables b ON a.name = b.name
WHERE b.name IS NULL;
-- Returns: 'categories' -- NOT EXISTS (often fastest with an index)
SELECT a.name
FROM expected_tables a
WHERE NOT EXISTS ( SELECT 1 FROM actual_tables b WHERE b.name = a.name
);
-- Returns: 'categories'If your data lives in a database, EXCEPT is the cleanest approach. For cross-database comparisons or when data is in JSON exports, paste the arrays into this tool instead.
Set difference is not symmetric. Elements missing from array B (present in A but not B) is a different set than elements missing from array A (present in B but not A). Always be clear about which array is the reference. In this tool, red highlights mean "in Array 1 but not Array 2" and green means "in Array 2 but not Array 1."
The string "alice " (with a trailing space) does not equal "alice". Invisible whitespace differences are one of the most common causes of unexpected missing elements. Trim your data before comparing. Similarly, watch for different line endings (\r\n vs \n) in strings extracted from files.
An element with value null in an array is not the same as the element being absent. [1, null, 3] has three elements; [1, 3] has two. When comparing arrays, null at position 1 will show as modified (null vs 3), not as a missing element. Be mindful of how your data source represents absent values.
Paste your expected (reference) array in the first panel and your actual array in the second panel. Click Compare. Elements highlighted in red are in the first array but missing from the second. Elements in green are in the second but not the first. Unchanged elements appear with no highlight.
Finding missing elements focuses specifically on absence — what should be present but is not. Array diff is more comprehensive: it also shows modifications (same position, different value), additions, and unchanged elements. This tool provides the full diff view, letting you focus on whichever aspect matters most.
Yes. The tool performs deep structural comparison. If your arrays contain objects like {"id": 1, "name": "Alice"}, the tool compares them field by field. An object present in one array with no matching counterpart in the other will be flagged as missing or added.
Yes. This tool runs entirely in your browser using client-side JavaScript. No data leaves your machine. You can safely compare production records, customer data, and sensitive business information.
SQL EXCEPT returns rows from the first query absent in the second — a set difference on tabular data. This tool does the same for JSON arrays but adds a visual diff showing context, handles nested structures, and works without a database. It is ideal when your data is in JSON format or exported from non-SQL sources.
Yes. Paste a complete sequence like [1, 2, 3, 4, 5] in the first panel and your actual sequence in the second. The diff will reveal which numbers are missing. Enable "Ignore array order" if the elements may appear in a different order.