YourTools.
简体中文
Back to the catalog
Tools

Line tools: trim, dedupe, sort

In one pass: trim lines, remove empty or duplicate lines, count repeats, filter by length, sort (including natural and pinyin order) and add a prefix or suffix.

Process locally

Files stay in this browser session. Closing or clearing releases them.

Add text

Type or paste the text to process

Adjust settings

Optional: Trim spaces, Remove empty lines, Duplicates and more

Line tools: trim, dedupe, sort

Run

Processes in this browser; cancel at any time

Add text first

About this tool

Clean up a list with one item per line: remove duplicate lines, delete empty lines, sort, and add text to the start or end of every line. It suits keyword lists, email lists, log lines, file names or a column copied from a spreadsheet.

All settings are applied in one run. Lines can be sorted by code point, in natural order where item2 comes before item10 and Chinese sorts by pinyin, by length, by how often they occur, in reverse or at random, and each line can show its count. Up to 1 MB of text is processed in your browser and is not uploaded.

How to use it

  1. Paste your list with one item per line, or select Use example.
  2. Choose how to “Trim spaces”, whether to “Remove empty lines”, and what to do with “Duplicates”.
  3. Pick a “Sort” order, and fill in “Minimum length”, “Maximum length”, “Prefix” or “Suffix” if you need them.
  4. Select Run, then preview lines.txt and download it.

Formats and limits

Input
Text
Output
Plain text
Size limit
1 MB
Settings
Trim spaces (Both ends, Start, End, Keep); Remove empty lines; Duplicates (Keep, Remove, Remove, ignoring case); Show how often each line occurs; Sort (Keep order, A to Z, Z to A, Natural, By length, Most frequent first, Reverse, Shuffle); Minimum length; Maximum length; Prefix
Privacy
Files stay in the current browser session. No file bytes are uploaded.
Price
Free, no sign-up

Common questions

How do I count how many times each line appears?

Set “Duplicates” to “Remove”, tick “Show how often each line occurs” and choose “Most frequent first” under “Sort”. Each line then starts with its count and a tab, so it pastes into a spreadsheet as two columns.

Which copy is kept when duplicates are removed?

The first one, in its original position. With “Remove, ignoring case”, Apple and apple count as the same line and the first spelling is kept. Lines that differ only in spaces at the ends match only when trimming is on.

What is the difference between code point and natural order?

“A to Z (code point)” compares characters by their Unicode values, so capitals come before lowercase letters, item10 before item2, and Chinese is not in pinyin order. “Natural (numbers by value, Chinese by pinyin)” compares numbers by value, sorts Chinese by pinyin and ignores case.

In what order are the settings applied?

Trimming comes first, then removing empty lines, the length filter, removing duplicates and sorting, and finally the prefix and suffix. So the prefix and suffix do not count toward the length or the sort order, and counts include only lines that passed the filters.

How is line length counted?

In characters after trimming, so a Chinese character counts as one, not as several bytes. Both limits include the boundary value, and 0 means no limit.