MegaTools.live
← All guides

Clean a pasted list without losing its order

Combine two lists, remove stray spaces and keep the first occurrence of each entry.

Start with one entry per line

Suppose your list contains “North”, “West ” and “West”. The space after the first West is easy to miss. Trim lines first so both versions have the same spelling. Spaces inside names such as “North West” stay intact.

Open Trim lines →

Keep the first copy

Paste the trimmed result into Remove duplicate lines. The three rows now become North and West, in that order. If West and WEST mean different things in your list, keep their capitalization.

Open Remove duplicate lines →

Check the resulting row count

Count the lines in the final list. For this example the result should be 2. If you get 3, look for a blank final line. A line count includes blank rows, so remove those before treating it as a count of entries.

Open Line counter →