Skip to content
Filebird

Sort & clean lines

Sort, deduplicate and tidy lists of lines

Files never leave your device

A lot of everyday text is a list: email addresses exported from a spreadsheet, product SKUs, URLs, names from a signup sheet, lines of a log. Cleaning such a list by hand is slow and error-prone. Line Tools applies one operation to every line at once. You can sort it alphabetically or by length, strip out duplicates and blank lines, trim stray spaces, reverse the order, number the lines, or join the list into one line separated by commas and split it back again.

How to clean up a list of lines

  1. Paste your list into the input box, one item per line. If your items are separated by commas or spaces instead, start with the split operation to turn them into lines.
  2. Pick the operation you need, such as sort, remove duplicates or trim whitespace.
  3. Review the output. The line count helps you confirm that duplicates or blanks were removed.
  4. To combine steps, copy the result back into the input and apply the next operation. Trimming first and then removing duplicates catches entries that differ only by a trailing space.
  5. Copy the final list into wherever it is going next.

Options explained

  • Sort A to Z and Z to A: Orders lines alphabetically, ascending or descending. Useful for glossaries, name lists and tidying configuration entries.
  • Sort by length: Puts the shortest or longest lines first. It is a quick way to find unusually long entries, such as a runaway URL or a pasted paragraph hiding in a list of names.
  • Numeric sort: Orders lines by their number rather than character by character. Plain alphabetical sorting puts 100 before 20 because "1" comes before "2"; numeric sorting gets it right.
  • Random order: Shuffles the lines. Use it to draw a running order, pick a winner or randomise quiz questions.
  • Remove duplicates: Keeps the first occurrence of each line and drops the repeats. Lines must match exactly, so "Apple" and "apple " count as different until you trim them.
  • Remove empty lines: Deletes blank lines left over from copying out of web pages, emails or PDFs.
  • Trim whitespace: Removes spaces and tabs at the start and end of each line.
  • Reverse: Flips the order of the lines, last to first.
  • Number lines: Adds a running number and a full stop in front of each line (1. text), handy for turning a list into numbered steps.
  • Join and split: Join folds all lines into a single line with a separator you choose; split does the opposite, breaking text at a separator into separate lines.

Tips and common problems

Trim before you deduplicate: The most common reason a duplicate survives is an invisible trailing space or a tab. Apply trim first, then remove duplicates.

Case matters unless you lowercase first: If "London" and "london" should be one entry, convert the list to lowercase with Case converter before removing duplicates. The trade-off is that you lose the original capitalisation.

Mixed text and numbers sort unpredictably: Alphabetical order puts "item 10" before "item 2". If the lines contain numbers in different positions, either number-pad them or sort only lists where numbers lead each line.

Blank lines are lines too: If a sort puts a group of empty lines at the top, they were in your input. Remove empty lines first.

Joining for spreadsheets and code: Joining with a comma and space produces a value list you can paste into a search box or an SQL IN clause. Check quotes and escaping yourself, since the tool only combines text.

Check what changed: After a big cleanup, run the before and after versions through Text diff to confirm that only the intended lines were affected.

Your files stay on your device

Every operation is carried out by your browser on text you paste in. The list is not uploaded or recorded, so it is fine to clean customer lists, internal URLs or private notes. Nothing extra has to be downloaded to run these tools. See How it works for a fuller explanation.

Frequently asked questions

Does remove duplicates keep the original order?

Yes. The first time a line appears it is kept in its position, and later identical lines are dropped. Sorting is a separate step you can run before or after.

Can I sort numbers properly?

Yes, use the numeric option rather than the alphabetical one. Alphabetical sorting compares character by character, so ten sorts before two.

How do I turn a comma-separated list into lines?

Use the split operation with a comma as the separator, then trim whitespace to remove the spaces that followed each comma.

Will it handle thousands of lines?

Yes, lists of many thousands of lines are processed quickly on a normal device. Extremely large lists depend on your browser's memory.

Is the random order truly random?

It is a shuffle meant for everyday use such as draws and playlists. For anything where fairness has serious consequences, such as a prize with legal rules, use an audited process.

Can I upload a file?

Paste the file's contents into the box. Anything you can open as plain text, including CSV and log files, can be cleaned this way.