Text Cleaner: Sort, Deduplicate, Trim, Split and Extract Lines
Remove duplicate lines, sort A-Z or numerically, trim, drop empty lines, split, join and extract emails or links with a step pipeline in your browser.
Runs in your browser. Nothing is uploaded.
TextText Cleaner
Your text
Max 20MB each
Result
Paste text on the left. The pipeline below runs on it as you type and the cleaned lines appear here.
Pipeline
Trim lines
Remove spaces and tabs around each line.
Remove empty lines
Drop lines with nothing on them.
Remove duplicate lines
Keep one copy of each line.
Sort lines
Order the lines.
Example
banana Apple cherry apple Banana cherry (steps: trim, remove empty lines, remove duplicates ignoring case, sort A to Z)
Apple banana cherry
A pipeline of line operations
Most text cleanup is a handful of small jobs done in the right order: trim the spaces, drop the blank lines, remove the duplicates, sort what is left. Here each job is a step. Add steps from the list, move them up or down, remove them, and the result updates as you type. The panel under the result shows how many lines each step removed or added, so you can see where a line went.
The available steps are trim (both ends, start or end), collapse repeated spaces and tabs, remove empty lines (optionally those with only spaces), remove duplicate lines, sort, reverse the order, add a prefix and a suffix, split lines at a separator, join lines with a separator, and extract emails, links or numbers. Ready-made pipelines cover the common cases such as cleaning a list, pulling emails out of a block of text or turning a comma separated list into lines.
Duplicates and sorting in detail
Duplicate removal keeps the first or the last occurrence and can ignore case and the spaces around a line. Order matters: trim before you remove duplicates, or "apple" and "apple " count as different lines. Sorting offers A to Z and Z to A with accents and case handled the way a dictionary would, natural order (file2 before file10), numeric order by the number a line starts with (decimals, negatives and thousands commas included; lines without a number go last), by length, and a random shuffle you can repeat.
Everything works on text that uses Windows (CRLF), Unix (LF) or old Mac (CR) line endings. If your input uses CRLF throughout, the output does too. Emoji, right-to-left text and accented letters are kept as they are.
Extracting emails, links and numbers: the limits
The extract step uses simple patterns on purpose. An email needs a name, an @ sign and a domain with a dot and at least two letters; quoted names, comments and address literals allowed by the full email standard are not recognised. A link starts with http://, https:// or www., ends at the next space or quote, and has trailing punctuation removed (balanced brackets in a Wikipedia address are kept). A number can have a sign, thousands commas, decimals and an exponent, and only ASCII digits are read, so 1.234,56 in European style is two numbers, not one.
These patterns find the usual cases, not every valid one, so check anything important by eye. Add a remove-duplicates step after extraction to get a unique list. Large inputs of hundreds of thousands of lines work, but sorting a huge list takes a few seconds and the page shows a working message meanwhile. Nothing is uploaded, because everything runs in your browser.
Frequently asked questions
How do I remove duplicate lines but keep the original order?
Add the remove duplicate lines step and keep the first occurrence; the lines that remain stay in their original order. Do not add a sort step.
Why do "apple" and "apple " survive as different lines?
Lines are compared exactly. Add a trim step before it, or switch on "Ignore spaces around lines" in the duplicate step.
What is natural sort?
It reads digit runs as numbers, so file2 comes before file10. A plain A to Z sort would put file10 first because 1 sorts before 2.
Does the email extractor find every valid address?
No. It finds ordinary addresses (name, @, domain with a dot). Unusual forms allowed by the email standard, such as quoted names, are not matched.
Can I clean a very large file?
Files up to 20 MB can be loaded and several hundred thousand lines work, but sorting a huge list takes a few seconds. Nothing is uploaded.
