TextMora / Text tools

Remove Duplicate Lines

Paste a list and keep only the first occurrence of each line. By default the original order is kept, you can sort the result, and the counts show what was removed.

Characters: 0
OptionsNone on
Characters: 0
Original lines: 0Retained: 0Removed: 0

Continue with…

Tool
Suggested
Suggested next step
Text to send

Workspace: empty. It is kept in memory only and cleared when you reload the page.

Clear workspace?

This removes the saved original text and last output that carry over between tools. Text currently typed into an editor stays where it is.

How to use the Remove Duplicate Lines

  1. Paste your lines into the input field.
  2. Choose options such as case-insensitive matching, and sort the result if you want.
  3. Copy the unique lines or download them as a TXT file.

Examples

Examples with the matching option used

Input (one line per row)Result
a, b, aa, b (no options)
A, aA (Case insensitive)
␣a␣, a␣a␣ (Trim for comparison; the first line is kept as written)
a, (empty line), ba, b (Remove empty lines)
b, c, a, ba, b, c (Sort lines: A to Z)

Limitations

  • The first occurrence of each line is kept and the later ones are removed. The order of the remaining lines only changes if you choose to sort them.
  • Sorting uses English alphabetical order that ignores capitalization when comparing, and reads numbers by value, so “item 2” comes before “item 10”. It does not follow the rules of other languages.
  • Matching is exact by default: “Apple” and “apple” are different lines unless you enable Case insensitive.
  • Trim for comparison and Case insensitive only affect matching. The kept line is output exactly as you wrote it.
  • Lines are joined with the first line break found in your text (Windows, Unix or old Mac style), or a Unix line break if there is none. A trailing line break is not kept.
  • Case insensitive matching uses standard Unicode lowercasing, not rules for a specific language.

Frequently asked questions

Which duplicate is kept?

The first one. Every later line with the same comparison key is removed.

Does it sort my lines?

Only if you ask it to. By default the remaining lines stay in their original order. Choose A to Z or Z to A under Sort lines to sort them after the duplicates are removed.

How are empty lines handled?

By default, empty lines are treated like any other line, so repeated empty lines collapse to one. Enable Remove empty lines to drop all empty and whitespace-only lines.

Is my text sent to a server?

No. Everything runs in your browser and the text is not sent to TextMora.

About TextMora: Free Online Text Tools for everyday writing, editing and formatting. Text you enter is processed in your browser and is never sent to TextMora.