Line Tools

Sort, dedupe, filter, trim, number, shuffle, split and join lines of text, with every step combined on one page.

Example input

9 lines

Result

9 lines in, 6 out, 1 empty line removed, 2 duplicates removed

Steps, applied top to bottom

  1. Leave empty for line breaks. Try a comma, or \t for a tab.
  2. Clean up
  3. Duplicates
  4. Sort
  5. Wrap each line
  6. Number
  7. Leave empty for line breaks. A comma and a space makes one line.

Related tools

What it does

A workbench for lists of lines. Sort alphabetically, naturally (item2 before item10), by length, or shuffle; remove duplicates keeping the first or last copy, or show only the duplicated or only the unique lines; trim spaces, drop empty lines, filter by text or regular expression, add a prefix or suffix to every line, number the lines, and split or join on any delimiter. The steps combine, and they always apply in the same order shown on the page.

How to use it

Paste a list or drop a text file into the input box and the result appears beside it as you go. Turn on the steps you need: they are numbered in the order they run, and the active ones are highlighted. The line under the result reports how many lines went in and came out and how many each step removed. Copy or download the result, or send it back to the input to run another pass. For a repeatable shuffle, set a seed.

Why this one

Most line sorting sites do one operation per visit, so trimming, deduplicating and sorting a list means three round trips, often past ads. This one chains every step on a single page, adds natural sort, seeded shuffling, regex filtering and duplicate reports that others skip, and tells you what each step removed. It runs entirely in your browser: your files and inputs never leave your device.

FAQ
What is natural sort and why does it matter?
Natural sort treats embedded numbers as numbers rather than characters, so "item2" sorts before "item10". Plain alphabetical order compares character by character and puts "item10" first. Use natural sort for file names, version numbers, and anything else with numbers inside the text.
How do I remove duplicate lines but keep the original order?
Set the Sort step to Keep order and the Duplicates step to Keep first. Each line then appears once, in the position of its first occurrence. Turn on Ignore case to treat Apple and apple as the same line, and Trim spaces so stray spaces do not hide a duplicate. The summary under the result shows how many duplicates were removed.
Can I turn a column of lines into a comma separated list?
Yes. Type a comma and a space into the Join with step and the result becomes a single line. To go the other way, type a comma into the Split on step and each item lands on its own line. Combine both with a prefix and suffix of a quote character to build a quoted list for SQL or code.

Keyboard shortcuts: press ? anywhere on this page to see them.