keentext
  1. Home
  2. Text cleaner

Text cleaner

Paste messy text, switch on the fixes you need, and copy the clean result. The steps run in the order shown.

Fixes, applied in this order

12 lines · 139 characters
6 lines · 95 characters

How to use the text cleaner

  1. Paste your text in the box on the left, or open a file.
  2. Switch fixes on and off with the chips. The result on the right updates immediately.
  3. Fixes run in the numbered order, whatever order you switch them on. Some exclude each other: you can only pick one way of sorting, for example.
  4. Copy the result or download it. Use as input puts the result back into the left box, so you can clean in several passes.

What each fix does

  • Strip HTML tags: removes tags like <b> and <div>, keeps line breaks where paragraphs ended, and turns codes such as &amp; and &nbsp; back into characters.
  • Smart → straight quotes: turns “curly” quotes and apostrophes into plain " and '. Useful for code, CSV files and text messages.
  • Straight → smart quotes: the opposite, for text that will be printed or published.
  • Trim lines: removes spaces and tabs at the start and end of every line.
  • Remove extra spaces: turns double spaces and tabs inside a line into one space, keeping the indentation at the start.
  • Join lines in paragraphs: removes the line breaks inside each paragraph and keeps the blank line between paragraphs. Perfect for text copied from a PDF.
  • Remove all line breaks: puts everything on one line.
  • Remove empty lines and remove duplicate lines: the first copy of each line is kept, in its place.
  • Sort: A to Z, Z to A, shortest first, or natural order, where “item 2” comes before “item 10”.

Common clean-ups

  • Text copied from a PDF: Join lines in paragraphs, then Remove extra spaces.
  • A list of emails or names: Trim lines, Remove empty lines, Remove duplicate lines, then Sort A → Z.
  • Text from a web page: Strip HTML tags, Trim lines, Remove empty lines.
  • Text for a text message or code: Smart → straight quotes, which also keeps an SMS at 160 characters instead of 70 (check it with the character counter).
  • To change capital letters, use the case converter; to compare before and after, the diff checker.

Questions and answers

How do I remove line breaks but keep paragraphs?

Switch on “Join lines in paragraphs”. Line breaks inside a paragraph are removed and the blank lines between paragraphs stay.

Why does text copied from a PDF have line breaks everywhere?

PDFs store each line of the page separately, so copying keeps a break at the end of every line. Join lines in paragraphs puts them back together.

Does removing duplicates change the order of my lines?

No. The first copy of each line stays where it was and later copies are removed. Blank lines are left alone; use Remove empty lines for those.

What is natural sort?

Sorting that reads numbers as numbers, so “file 2” comes before “file 10”. Plain A → Z sorting compares character by character and would put “file 10” first.

Is my text uploaded?

No. Everything happens in your browser and nothing is saved or sent. Your choice of fixes is remembered in this browser for next time.