📝 Line Sorter and Deduplicator
Sort, deduplicate, shuffle, reverse, or trim lines of text. Case-insensitive, natural sort, length sort, and prefix/suffix options.
Last updated: November 8, 2026 · By the BoltQuickTools team
Cleaning up a list one pass at a time
Lists pasted from logs, spreadsheets or email tend to arrive with repeats, stray spaces and blank lines, and file10 sorted ahead of file2. This page applies sorting and cleanup together, so you can get a finished list without a shell or a spreadsheet.
Setting it up
- Paste into Input, one item per line, or click Sample.
- Choose a mode in Sort: No sort, A to Z, Z to A, Natural A to Z (1, 2, 10), Natural Z to A, Length ascending, Length descending, Shuffle or Reverse order.
- Tick any of Case-insensitive sort, Remove duplicates, Dedupe ignoring case, Trim whitespace, Drop empty lines and Lowercase output. Case-insensitive sort and Drop empty lines start ticked.
- Optionally fill Prefix each line and Suffix to wrap every line, for example to make a bullet list or quoted values.
- The Output updates as you change anything. Use Copy to take it, or Use Output as Input to run a second pass.
The steps always run in the same order: trim, drop empties, lowercase, dedupe, sort, then prefix and suffix.
A full example
Click Sample for this input:
banana
apple
Cherry
banana
file10.txt
file2.txt
file1.txt
date
elderberry
apple
With the default settings the blank line goes, but the repeats stay, the padded line sorts first because its leading spaces count, and file10.txt comes before file2.txt:
date
apple
apple
banana
banana
Cherry
elderberry
file1.txt
file10.txt
file2.txt
Change Sort to Natural A to Z (1, 2, 10), tick Trim whitespace and Remove duplicates, and set the prefix to a hyphen and a space:
- apple
- banana
- Cherry
- date
- elderberry
- file1.txt
- file2.txt
- file10.txt
The stats line then reads Input: 11 lines · Output: 8 lines · 82 chars.
Results that may surprise you
- Unticking Case-insensitive sort does not give ASCII order. Comparison uses your browser's locale, so
b,A,a,Bsorts toa,A,b,B. Unixsortunder the C locale would put capitals first. Accented letters can also vary with your browser language. - Natural sort is not numeric sort. It compares runs of digits, so decimals behave like version numbers (
1.5before1.10), and negative numbers are not ordered by value (-1before-10). For plain numbers, use Sort numeric in the text tools page. - Whitespace-only lines survive unless Trim whitespace is also ticked, since Drop empty lines only removes lines that are truly empty.
- Dedupe keeps the first occurrence and compares lines exactly, so with trim off,
fooandfooare different lines. - Length sorting counts UTF-16 code units, so an emoji usually counts as 2. Lines of equal length keep their input order.
- Shuffle runs again on every change. Editing the input, ticking a box or clicking Apply gives a new order, so copy the result once you have one you want.
- A trailing newline adds one to the input count, because the final empty line is counted.
To see what changed between two versions of a list, use text diff. For changing capitalisation beyond lowercase, the case converter has more options.
Practical questions
How do I remove duplicates but keep the original order?
Set Sort to No sort and tick Remove duplicates. Each line stays where it first appeared.
If I dedupe ignoring case, which spelling is kept?
The first one in the input. With Foo then foo, the output keeps Foo. Tick Lowercase output if you want a uniform result.
Can I turn a list into a comma-separated SQL list?
Partly. Set Prefix each line to ' and Suffix to ',. Each value then sits on its own line with quotes and a comma, and you remove the final comma yourself.