Data ToolsA little help for every day

Search by name or task, such as JSON or percentage.

Data Tools

Remove Duplicates from a List or Array

Remove duplicates from a list, comma-separated values or a JSON array, keep the original order or sort, ignore case, dedupe objects by field and count repeats.

View all tools
ResultUpdates as you type
apple
Banana
orange
banana
kiwi

7 items in, 5 unique, 2 duplicates removed (1 value appeared more than once).

How to use Remove Duplicates from a List or Array

Paste a list with one item per line, comma-separated values or a JSON array; the de-duplicated result appears as you type. Choose case handling, sorting and output format, then press Copy result.

  1. Paste your list or arrayPaste one item per line, values separated by commas, or a JSON array. The format is detected automatically.
  2. Set the matching rulesTick Ignore case or Keep the last occurrence, or enter a field such as id to dedupe an array of objects.
  3. Sort and copyChoose an order and output format, tick List duplicates with counts if needed, then press Copy result.

How duplicates are matched: an example

The sample list has seven lines: apple, Banana, apple, orange, banana, kiwi, apple. By default the result keeps five items, apple, Banana, orange, banana and kiwi, in the order they first appeared, and the note reports 2 duplicates removed. Tick Ignore case and Banana and banana count as the same value, leaving four. Spaces at the start and end of each item are trimmed by default. A single line is split at commas, including full-width Chinese commas, so red, green, red works too. Ascending sort orders numbers by value, putting 9 before 10, and Most frequent first ranks values by how often they appear.

De-duplicating JSON arrays and objects

When the input is a JSON array, items are compared by value and type, so the number 1 and the string "1" are different, while two objects with the same keys and values count as duplicates even if the keys are in a different order. For arrays of objects, enter a field in Unique by field, such as id or user.email, to compare only that field; [{"id":1,"n":"a"},{"id":2,"n":"b"},{"id":1,"n":"c"}] keeps one object per id. Tick Keep the last occurrence to keep the later copy instead, here {"id":1,"n":"c"}. Items without the field are compared as a whole, and a warning says how many. Output defaults to the input format, so a JSON array stays a JSON array.

Accuracy and data handling

Keep the original data and spot-check fields, types and delimiters before using an important conversion. The calculation runs in your current browser; the tool code does not send the input to a processing API.

FAQ

Does removing duplicates change the order?

No. Each value stays where it first appeared. You can keep the last occurrence instead, or sort the result ascending, descending or by how often each value appears.

Is the duplicate check case-sensitive?

Yes, by default Apple and apple are different items. Tick Ignore case to treat them as duplicates; the spelling that appears first is kept.

Can I see how many times each value appears?

Yes. The note gives the number of items in, unique items and duplicates removed, and ticking List duplicates with counts adds a table of every repeated value with the number of times it was seen.

Can I remove duplicate objects by ID?

Yes. Paste a JSON array of objects and type the key, such as id, or a nested path such as user.email, in Unique by field. Only the first object for each value is kept.

More Data Tools

Related tools