One operation at a time
Sort, trim, and count lines
Lists in a text box are awkward to clean by hand. This page trims, filters, sorts, or reverses the lines, and always shows the counts.
Trim removes space at both ends of each line. Drop blanks trims and then removes empty lines. Unique keeps the first copy of a line. Sort uses the browser's locale order. Reverse flips the current line order and does not sort first. Counts treat a character as a code point and a byte as UTF-8. The page does not treat the text as CSV.
The list stays in this tab.
This tool runs in your browser. Turn on JavaScript to use it.
Unique keeps the first copy
The repeated line disappears. The earlier one stays where it was.
- Before
- red blue red
- Unique
- red blue
How to use it
- 1Paste the lines.
- 2Read the counts, or run one cleanup.
- 3Copy the result. Run another operation if you still need it.
Good to know
- Sort follows this browser's locale.
- Unique is case-sensitive.
- Bytes are UTF-8, not UTF-16.
Questions
Does reverse also sort?
No. Reverse only flips the current order.
Why is the character count smaller than the byte count?
Characters outside ASCII use more than one UTF-8 byte.
Can I sort numbers?
Sort is alphabetical. 10 comes before 2.
Related tools
- Compare two texts by line
Two copies of a list or a config rarely differ in every line. This page marks lines that only the first text has and lines that only the second text has.
- Make a URL slug
A slug is the readable tail of a URL. This page lowercases the text, removes accents, and joins the remaining words with hyphens.
- Convert CSV and JSON
CSV is a table in text. This page parses quotes and doubled quotes, then prints JSON, or walks a JSON array and prints CSV.