Home / Guides

How to Clean Text: A Step-by-Step Checklist

Published 2026-11-01

To clean text, work in a fixed order: look at what is actually in it, remove invisible characters, replace odd spaces, fix quotes and dashes, tidy spaces and blank lines, strip leftover formatting, then check the result. This guide is a routine you can follow every time, a way of thinking about how to clean text rather than a pile of one-off tricks. It links to a detailed guide for each step, and shows how a text cleaner handles the steps in one go.

How to clean text: the short version

  1. Find out what the problems are.
  2. Remove invisible characters.
  3. Replace unusual spaces with normal ones.
  4. Fix quotes, dashes and the ellipsis.
  5. Tidy repeated spaces and blank lines.
  6. Remove formatting and leftover Markdown.
  7. Check the result.

The order matters. Invisible characters and odd spaces first, because they make later steps miss things. Spacing last, because the earlier steps can leave extra spaces behind.

Step 1: see what is in the text

Text that looks fine can contain things you cannot see. Before changing anything, check for the usual causes.

SymptomLikely causeGuide
Search or equality check fails on text that looks identicalInvisible characters or non-breaking spacesInvisible characters
Words will not wrap, or two words stay glued togetherNon-breaking spaces or hyphensNon-breaking space
Strange symbols such as ’ or éWrong encodingMojibake
Quotes look curved and break code or CSVSmart quotesSmart quotes
Long dashes everywherePasted AI or word-processor textEm dash
Lines break in the middle of sentencesHard line breaks from a PDF or emailRemove line breaks
Asterisks and hashes around wordsMarkdownRemove Markdown
Fonts, colours and sizes carried overFormattingRemove formatting

Practical ways to look:

Our guide to showing hidden characters has the full list of apps.

Step 2: remove invisible characters

These are the characters with no width: the zero-width space, zero-width joiner and non-joiner, the word joiner, the byte order mark, the soft hyphen and the left-to-right and right-to-left marks. They arrive with text copied from websites, chat tools, PDFs and some editors.

Delete them before anything else, because they sit inside words and can stop later find-and-replace steps from matching. See zero-width space and byte order mark for the details of the two most common ones.

One exception is worth knowing. The zero-width joiner is part of how some emoji and some scripts are written. Removing it from a family emoji splits the emoji into separate people, and removing it from certain scripts changes how letters join. Clean those texts with care, and see zero-width joiner. The cleaner keeps the joiner and non-joiner where they hold an emoji sequence together.

Step 3: replace unusual spaces

The non-breaking space, thin space, em space and ideographic space all look like gaps but are different characters from the ordinary space. Replace them with a normal space so that searches, comparisons and line wrapping behave. The list is in the guide to Unicode spaces.

Step 4: fix quotes, dashes and the ellipsis

These are typographic characters that look correct to a reader and cause trouble for software.

Decide by destination. A blog post can keep its typography. A database field usually should not.

Step 5: tidy spaces and blank lines

With the odd spaces gone, collapse any run of repeated spaces into one, and remove spaces at the ends of lines. Then reduce long gaps of empty lines. The detailed methods are in remove extra spaces and remove empty lines.

If the text is hard-wrapped, with a line break at the end of every visual line, joining the lines is a separate decision. See how to remove line breaks.

Step 6: remove formatting and leftover Markdown

Formatting means fonts, colours, sizes and links. The quickest fix is to paste as plain text, as described in paste without formatting, or to convert the document with the methods in convert to plain text. For symbols such as ** and # that came from a chat tool, see remove Markdown from text.

Step 7: check the result

Which options to use for which job

DestinationSuggested settings in the cleaner
Web form, spreadsheet or CSVDefaults on, including quote straightening and the long-dash replacement
Blog post or document that readers will seeKeep invisible characters and odd spaces on. Turn off quote straightening and set long dashes to keep, if you want the typography
Text from an AI chatDefaults, plus Strip Markdown formatting if the answer has asterisks or hashes
Code, JSON or configurationInvisible characters, spaces and quotes on. Leave Markdown off, because it removes backticks and asterisks
Text mixing Latin letters with other alphabetsAdd Fix lookalike letters if you see words that search cannot find

What the cleaner does for you

The AI Text Cleaner runs steps two to five in the correct order whenever you paste. By default it removes invisible characters and control codes, replaces unusual spaces, straightens quotes, swaps long dashes and the ellipsis character, collapses repeated spaces, trims line ends, reduces blank lines and trims the text. Strip Markdown formatting, en dash replacement, lookalike letters and Unicode normalisation are optional and off by default. A summary shows how many changes it made. All of it runs in your browser, and the text is not uploaded.

It does not change the wording, fix spelling, convert case, remove HTML tags or delete punctuation. Those jobs need a different tool, and some of them are covered in the guides linked above.

Mistakes to avoid

Quick answers

What is the best way to clean text? Paste it into a plain-text tool that removes invisible characters and odd spaces, then check the parts that are specific to your task, such as Markdown or line breaks.

How do I clean text copied from a website? Paste as plain text, then remove invisible characters and non-breaking spaces. Web pages are full of them.

Can a text cleaner damage my text? Only if the options do not suit the content. Straightening quotes and stripping Markdown are the two that change visible characters, so turn them off for text where those characters matter.

Run the whole routine in one pass. The default options handle steps two to five, and the summary tells you what changed. Open the AI Text Cleaner

Related guides