array-operations
Array operations β union, intersection, difference, symmetric difference β answer common data-cleanup questions. "What emails are in list A but not list B?" β difference. "What IDs appear in both?" β intersection. "All unique values across both lists?" β union. The ZTools Array Operations tool accepts two arrays (one item per line, or comma-separated, or JSON), runs the operation in the browser, and returns the result with counts. Case-sensitive or insensitive, trim-or-not, dedupe-or-keep-duplicates β all configurable.
Use casesβ
Cross-reference user listsβ
Marketing wants emails on List A but NOT on the unsubscribe list. Difference operation gives the answer instantly.
Find shared customersβ
Two products, two CSVs of user IDs. Intersection shows users of both β your cross-sell candidates.
Spot drift in two configsβ
Two YAML files list allowed origins. Symmetric difference reveals which entries are in one but not the other.
Validate a migrationβ
Old DB had 10,234 records. New DB has 10,233. Difference points to the one record that didn't migrate.
How it worksβ
- Paste list A and list B β One item per line, comma-separated, or JSON array. Tool auto-detects format.
- Pick operation β Union (A βͺ B), Intersection (A β© B), Difference (A β B), Symmetric Difference (A β B = items in exactly one).
- Configure matching β Case-sensitive (default), trim whitespace, treat numbers as numbers (so "1" matches 1).
- Read result β Output list plus counts: {input A: 1024, input B: 998, result: 76}. Copy as plain list or JSON.
Examplesβ
Input: A = [1,2,3,4]; B = [3,4,5,6]
Output: Union: [1,2,3,4,5,6]. Intersect: [3,4]. AβB: [1,2]. BβA: [5,6]. Symmetric: [1,2,5,6].
Input: A = emails subscribed; B = emails bounced
Output: AβB = clean recipients. Use this list for the next send.
Input: Case-insensitive intersection of "Alice" and "alice"
Output: [Alice] (or [alice] β picks first occurrence). Without case-insensitive matching, the result would be empty.
Frequently asked questionsβ
How big can the lists be?
Browser memory is the limit β 1 million items per side works fine in modern browsers. The Set data structure makes operations O(n).
Does order of inputs matter?
Union and intersection: no. Difference: yes β AβB differs from BβA.
What about duplicates within a list?
By default, treated as a set (deduplicated). Toggle "preserve duplicates" if you need multiset semantics (e.g. counting).
Does it support objects?
Primitive comparison only β strings, numbers, booleans. For objects, key on a stable property (id) and operate on that array.
Privacy?
All processing in the browser. Emails / IDs / customer data never leave your device.
Tipsβ
- For very large lists, paste as JSON arrays β faster than line-splitting in the browser.
- Trim whitespace by default β accidental trailing spaces are the #1 cause of "items don't match".
- For approximate matching (fuzzy), use a fuzzy-search tool first to canonicalise, then array-op the cleaned lists.
- Combine with the Find Duplicate Items tool when you need duplicates inside a single list, not across two.
Try it nowβ
The full array-operations runs in your browser at https://ztools.zaions.com/array-operations β no signup, no upload, no data leaves your device.
Last updated: 2026-05-06 Β· Author: Ahsan Mahmood Β· Edit this page on GitHub