TEXT COMPARISON GUIDE

How to Remove Duplicate Lines Without Changing Their Order

Clean up a packing list or shortlist without sorting it. See which copy stays, when repeated lines carry useful information, and how spaces and blank lines affect the result.

4 min readBy Pattobako

Keep the first copy. Leave the order alone.

When you combine a few packing lists or a shortlist of ideas, repeated entries can get in the way. Sorting helps put matching items together, but it also loses the order you chose.

You don't have to sort first. Keep each line the first time it appears and remove later copies. The remaining items stay in their original order. Before you do that, check whether a repeated line means an accidental copy or a separate item you actually need.

A packing list: six lines become four

Here is a made-up list combined from two notes. In this example, “Towel” appears twice because it was copied twice—not because you need two towels.

Before cleanup

Phone charger
Towel
Water bottle
Phone charger
Hat
Towel

After cleanup: first occurrence kept

Phone charger
Towel
Water bottle
Hat

The second “Phone charger” and the second “Towel” disappear. They don't have to be next to the first copy. “Hat” stays after “Water bottle”; nothing moves into alphabetical order.

This does not keep the newest version of an item. It compares whole lines, so “Phone charger” and “Phone charger (spare)” both stay.

Matching options don't rewrite the line you keep

By default, a line must match exactly to count as a duplicate. You can choose to ignore spaces at the start and end, uppercase and lowercase, or both. Try these three lines; the first has one space before and after “Towel.”

Three lines with different spacing or capitalization

 Towel 
towel
Towel

Scroll sideways to see the full table.

Changing the matching rules changes the result
Options selectedLines remainingWhy
None3Spaces and capitalization both count
Ignore spaces at the start and end2Lines 1 and 3 match
Ignore those spaces and capitalization1All three match

Even with both options selected, the result is the original first line, including its spaces and capital T. The options change the comparison, not the spelling or spacing of the output. Spaces within a line and different wording still count as differences.

Some repeats are information, not clutter

  • A list of item types can usually have one of each. That works for a packing checklist or a shortlist where you want each option to appear once.
  • A record of events needs a different approach. Two identical purchase entries could represent two purchases. Two matching names may belong to different people. Removing a row would lose information.
  • Paragraphs are not lists. A repeated heading or “Thank you” may belong in several places. This tool compares lines, not their meaning or the section they belong to.

Blank lines need care too. Even with the default options, later copies of an identical blank line are removed. That can collapse paragraph spacing. Selecting “Remove empty lines” also removes the remaining blank lines and lines containing only spaces.

For example, four lines containing A, a blank line, A, and B become just A and B when you remove empty lines. “Lines removed: 2” means one duplicate and one blank line—not two different items.

Keep the original, then review the cleaned copy

  1. Save your original list separately. Paste one item per line into “Original text.”
  2. Start with every matching option off. Only change the space, capitalization, or empty-line options if those differences should be ignored.
  3. Check the remaining items and their order. Use “Copy cleaned text” and paste the result into a separate note.

Your text is processed in your browser, not uploaded. Reset clears the input, so keep any text you still need before using it.

Remove duplicate lines and keep their order →

If you need to find items missing from one of two lists, compare the lists separately instead. Once you combine them and remove repeats, the result no longer tells you which list an item came from.