Whitespace Trimmer
Normalize messy whitespace in text by collapsing repeated spaces, tabs, or mixed space+tab runs into a single space. Useful for cleaning copied text from PDFs, emails, spreadsheets, and logs; formatting JSON/CSV headers; and fixing alignment issues caused by inconsistent tab/space usage. Choose whether to compress spaces, tabs, or both—output is generated separately so you can compare before/after safely.
Text
Try it
Examples
a b
a b
abc
a b c
a b
a b
How Whitespace Normalization Works
This page compresses repeated spaces, repeated tabs, or mixed runs of spaces and tabs into a single normal space depending on the option you select. It is meant for cleanup, not for preserving layout exactly. That is why the output is best thought of as a tidier working version of the original text.
Spaces vs Tabs vs Mixed Whitespace
Spaces-only mode compresses repeated spaces. Tabs-only mode compresses repeated tabs. The combined mode compresses any run made of spaces and tabs together. In every case, the replacement is a single ordinary space character, not a preserved tab.
What This Tool Changes and What It Leaves Alone
It changes selected horizontal whitespace runs only. It does not reorder lines, rewrite wording, remove punctuation, or perform broader document formatting. That narrower scope is useful when you want predictable cleanup without accidentally changing the text itself.
Example: Cleaning Pasted Spreadsheet and PDF Text
Copied text from PDFs and spreadsheets often contains uneven spacing that makes quick reuse awkward. Compressing those runs can make a rough export much easier to read before you paste it into a form, note, or another cleanup tool.
Example: Tabs Converted to Single Spaces
A common point of confusion is that tab compression still outputs normal spaces. That is intentional. The goal is consistent readable text, not preserving tab characters as layout controls in the cleaned result.
When to Use This Tool Before Other Text Cleanup
Whitespace normalization often makes later cleanup easier. After compressing spacing, you may find it simpler to compare lines, dedupe entries, parse fields, or paste the text into a CMS or spreadsheet without wrestling with inconsistent horizontal spacing.
Cases Where You Should Not Normalize Whitespace
Avoid this step when indentation, fixed-width alignment, code formatting, or tab-based structure actually matters. In those cases the repeated whitespace is part of the meaning or readability of the content, and compressing it can make the result worse.
Limits of Simple Whitespace Compression
Before You Rely on Trimmed Text in Code, Data, or Templates
Before replacing the original text, check whether indentation, alignment, tabs, or repeated spaces matter to the destination system. This page is useful for browser-local cleanup, but spacing-sensitive workflows should always get a final manual review before reuse.
When Whitespace Cleanup Can Change Parsing, Layout, or Meaning
Whitespace is not always cosmetic. In code, data files, templates, and copied tabular text, spaces and tabs can affect layout or even parsing behavior. A cleaned result may look nicer while still being wrong for the original destination if spacing carried functional meaning.
How to Interpret Trimmed Text Output
Trimmed output removes or normalizes extra whitespace to make the text easier to copy, compare, or reuse. That is often helpful for cleanup, but it also means spacing that once separated columns, alignment, or visual grouping may be simplified in the result.
This is a lightweight cleanup helper, not a document-format repair system. It cannot infer semantic structure, rebuild tables, or decide which spacing should remain for presentation reasons. It simply compresses the selected whitespace runs into one space.
Related tools
Remove Duplicate Lines
Remove duplicate lines while keeping the first occurrence of each value. Useful for cleaning email lists, log output, keyword exports, CSV snippets, copied spreadsheet columns, and prompt inputs before you paste them elsewhere. ToolMill runs entirely in your browser, so sensitive text never has to leave your device.
Text
HTML to Plain Text Converter
Convert HTML to plain text when cleaning email templates, scraped snippets, CMS exports, support content, or copied web pages. It helps you remove markup quickly while preserving readable text for notes, documents, prompts, or downstream processing. ToolMill does the conversion in-browser, which is useful when the source HTML contains private or client-sensitive content.
Text
Markdown to HTML Converter
Convert Markdown to HTML when preparing blog posts, documentation, README content, CMS entries, emails, or knowledge-base articles. It is helpful for checking how headings, emphasis, lists, and code-style content will render before publishing. ToolMill runs locally in your browser, making it a quick privacy-friendly alternative to online converters that upload your draft text.
Text
Remove Empty Lines from Text
Remove blank lines from pasted text instantly while keeping the remaining lines in the same order. This is useful for cleaning logs, lists, copied spreadsheet columns, CSV or TSV snippets, code blocks, email drafts, and text pulled from PDFs or chat exports. ToolMill runs entirely in your browser, so private text stays on your device.
Text
