How to Use ArrayDiff - Complete Guide
Learn how to compare arrays online with our free array diff tool. Follow these steps to detect changes in Python lists, JavaScript arrays, PHP arrays, and any JSON-compatible data. ArrayDiff runs entirely in your browser — your data never leaves your device.
1. Paste Your First Array
Copy and paste your first array into the left input panel. The tool accepts JSON arrays, including arrays of strings, numbers, booleans, objects, and nested arrays. It also handles common non-JSON syntax like single-quoted strings, trailing commas, and unquoted keys — automatically correcting them before comparison.
If your data comes from a specific language, serialize it to JSON first. For example, use json.dumps() in Python, JSON.stringify() in JavaScript, or json_encode() in PHP.
[{"name": "John", "age": 30}, {"name": "Jane", "age": 25}]2. Paste Your Second Array
Paste the second array into the right input panel. This can be a different version of the same data — for example, an updated API response, a modified config file, or test output you want to validate against expected results.
ArrayDiff supports inputs up to 5 MB with up to 50,000 elements and 10 levels of nesting depth. The tool handles deeply nested arrays and arrays of objects with full recursive comparison.
[{"name": "John", "age": 31}, {"name": "Bob", "age": 28}]3. Compare Arrays
Click the "Compare" button to run the diff. The tool parses both arrays, performs an element-by-element comparison, and renders the results instantly. For objects, it compares key-value pairs and uses string similarity matching to identify modified elements versus entirely new or removed ones.
Keyboard shortcut: Press Ctrl+Enter (or Cmd+Enter on Mac) to compare without reaching for the mouse. Press Ctrl+L to load sample data if you want to explore first.
4. Analyze Results
The comparison results appear as a side-by-side view with color-coded lines. Each element is categorized as one of four types:
- Green (Added): Elements present in the second array but not the first
- Red (Removed): Elements present in the first array but not the second
- Yellow (Modified): Elements that exist in both arrays but with different values
- Gray (Unchanged): Elements identical in both arrays
A summary bar at the top shows the total count for each change type, giving you an at-a-glance overview of how much changed between the two arrays.
Supported Formats and Languages
ArrayDiff accepts any data that can be represented as a JSON array. Here are the most common workflows by language:
Python
Convert lists or dictionaries with json.dumps(data) and paste the output. Works with pandas DataFrames exported via .to_json(orient='records'). See Python list diff for detailed examples.
JavaScript / TypeScript
Use JSON.stringify(array) to serialize your data. Ideal for comparing React state changes, Redux snapshots, and Node.js API responses. See JavaScript array compare.
Common Workflows
Developers use ArrayDiff for tasks where spotting differences in structured data matters. Here are the most popular workflows — see our examples page for full walkthroughs with sample data:
API Response Testing
Compare API responses before and after version changes to catch breaking changes, missing fields, or unexpected value shifts. Paste the JSON response from each version and diff instantly.
Config Validation
Diff configuration files across staging, production, and local environments. Catch mismatched feature flags, wrong database URLs, or missing environment variables before they cause outages.
Database Migration Checks
Compare query results before and after schema migrations. Verify that data was transformed correctly, foreign keys are intact, and no rows were dropped.
Pro Tips
- Use Sample Data: Click the "sample data" link below the Compare button to load example arrays and see how the tool works before pasting your own data
- Keyboard Shortcuts:
Ctrl+Lloads sample data,Ctrl+Enterruns the comparison — no mouse needed - Privacy First: All processing happens in your browser using client-side JavaScript. No data is uploaded to any server, ever
- Works Offline: Once the page loads, the tool works without an internet connection — perfect for comparing sensitive production data
- Format Flexibility: The parser auto-corrects common issues like single quotes, trailing commas, and unquoted object keys, so you can paste raw console output without cleaning it up first
- Other Diff Tools: Need to compare non-array data? Try JSON Diff for objects, Text Diff for plain text, or CSV Diff for tabular data
Ready to Compare Arrays?
Try our free array diff tool now — no sign-up required
Start Comparing Arrays