Text Cleaner
TextEverything runs locally in your browser — nothing is uploaded
Anything copied out of a log, a spreadsheet or a chat tends to arrive with duplicate lines, blank lines, leading numbers and stray spaces. This tool splits the cleanup into six rules you can switch on one at a time. The order is fixed — strip line numbers, collapse spaces, trim, drop blank lines, deduplicate, then sort — because order changes the result: sorting before deduplicating keeps a different line than deduplicating first.
Features
- Deduplicate lines, keeping the first occurrence and preserving the order of the rest
- Sort by code point (ascending or descending), by length, naturally (item2 before item10), or by pinyin
- Pinyin sorting keys on the whole reading, so ties on the first letter fall through to the rest (zhang before zhao) instead of collapsing to code point order
- The 447 KB pinyin table is downloaded only when that sort mode is actually chosen
- Deduplicate with case ignored when you want it: Foo and foo count as one line, while the surviving line stays verbatim
- Remove blank lines, including lines holding only spaces or tabs when trimming is enabled too
- Trim leading and trailing spaces on every line
- Strip line numbers written as 1. / 1) / (1) / 1: without mistaking dates or times for numbering
- Collapse runs of spaces, tabs and full-width spaces into a single space
- Every rule is independent — with none ticked the text passes through unchanged apart from LF endings
How to use
- Paste the text you want to clean
- Tick the rules you need; the result updates as you type
- Click Copy to take the result
FAQ
- How does deduplication decide what to keep?
- By default it is case sensitive: the first occurrence of each line is kept and later duplicates are dropped, leaving the order of the rest untouched. Tick ignore case to treat Foo and foo as one line — the surviving line is still the original text, so it will not quietly change your casing for you.
- I removed blank lines but some are still there. Why?
- A line containing only spaces or tabs is not an empty string. Turn on trimming as well and those lines become truly empty, after which they are removed. The two rules are meant to be used together.
- Will stripping line numbers eat real numbers in my text?
- No. The rule requires a clear separator after the digits (a dot, comma, colon, bracket and so on) and whitespace after that, so dates such as 2026.09 and times such as 3:00 are left alone.
- What is the difference between pinyin and code point sorting?
- A large one. Code point order sorts by the Unicode numbers of the characters, so a surname read “zhang” (U+5F20) can come before ones read “li” and “wang” (U+674E, U+738B) — an order meant for programs, not for readers. Pinyin order keys on the reading of each line: li → wang → zhang, the order used in rosters, directories and contact lists. When first letters tie it keeps comparing the rest (zhang before zhao) rather than falling back to code points. Note that the pinyin table is a separate 447 KB file, downloaded only when you select that mode — anyone who does not use it is unaffected.
- Is the sort order stable?
- Ascending and descending compare code points rather than locale-aware collation, so the same input always produces the same output; note that uppercase sorts before lowercase. Two other orders are offered because code point order is often not what you want: by length, and natural order, where item2 comes before item10 (plain sorting gives item1, item10, item2).
Related tools
Word Counter
TextCount Chinese characters and English words separately, alongside characters, lines, real UTF-8 bytes, reading and speaking time, and SMS segment counts.
Text Diff
TextCompare two blocks of text online and highlight added, removed and unchanged lines, so only the lines that changed are marked. Runs in your browser.
Case Converter
TextConvert identifiers between fourteen naming styles. Words are split correctly first, so acronyms such as HTTPServer come out right, all in your browser.
Chinese Converter
TextConvert Chinese between simplified and traditional characters, leaning on common words first and the most usual form for the rest, all in your browser.
Regex Tester
TextTest a regex in the browser: live highlighting, capture groups, replace preview, a backtracking guard — and JavaScript, Python, Java, Go or PHP code.
Markdown Preview
TextWrite Markdown on the left, see it rendered on the right — heading anchors, a table of contents, highlighted code blocks. Pasted HTML stays text.