First decide what “delete space” means

Deleting a space can mean several different transformations. You may want to remove every horizontal separator from an identifier, turn repeated gaps into one regular space, clear indentation at the start of each line, or fix a hidden no-break character without changing ordinary spaces. These results are not interchangeable.

The safest first step is to describe the unwanted behavior rather than the way the text looks. A large visible gap might be several U+0020 spaces, a tab, or a typographic space. A normal-looking gap might be a non-breaking space. Empty rows and line breaks are vertical structure, not simply extra horizontal spacing.

Choose the correct space-removal method

GoalRecommended methodImportant consequence
Clean repeated gaps in proseCollapse horizontal whitespace runs to one regular spaceWords remain separated and line breaks remain
Create text with no horizontal spacesRemove all supported horizontal whitespaceWords, numbers, and values join together
Remove indentation or right-edge residueTrim the leading, trailing, or both edges of every lineInterior spacing remains unchanged
Fix columns or indentation made with tabsRemove tabs or expand them to tab stopsTSV data and code indentation may change
Fix text that refuses to wrapConvert non-breaking spaces to U+0020Visible separation remains, but normal wrapping returns
Join wrapped linesUse a line-break tool with the appropriate paragraph modeAddresses, poetry, code, and tables need review
Remove blank rowsRemove or collapse empty linesParagraph spacing can be reduced

How to collapse extra spaces without joining words

  1. Open the Remove Spaces tool.
  2. Paste a representative sample and review the whitespace audit.
  3. Choose Multiple Spaces.
  4. Process the text and compare the changed-character count.
  5. Check at least one line that contains tabs, unusual spaces, or indentation.
  6. Copy the result only after confirming that intentional structure remains.

Multiple Spaces mode converts each supported run of horizontal Unicode whitespace to one regular U+0020 space, trims the beginning and end of each line, and preserves stored line breaks. It is the better default for sentences and paragraphs because it keeps a visible boundary between words.

Before: The report[tab]contains extra gaps. After collapsing: The report contains extra gaps.

How to remove all spaces from text

  1. Keep a copy of the original text.
  2. Choose All Spaces on the main tool.
  3. Process a short sample before using a large input.
  4. Confirm that joining words or values is the intended result.
  5. Review each stored line, because line breaks are preserved.

All Spaces mode removes supported horizontal whitespace characters instead of replacing them. It is useful for controlled identifiers, compact values, or text that is deliberately required to contain no horizontal separator. It is usually wrong for ordinary prose because red apple becomes redapple.

Before: AB 12 34 After removing all horizontal spaces: AB1234 Before: Read this sentence After removing all horizontal spaces: Readthissentence

Trim line edges when interior spaces are correct

If the only problem is indentation, padding, or trailing residue, do not run a broad replacement. The Trim Lines tool can remove leading whitespace, trailing whitespace, or both from every line while leaving the spacing inside each line unchanged. This is useful for lists copied from tables, padded exports, and text that must retain intentional word boundaries.

Trimming is still a structural change. Leading whitespace can define nested Markdown, source-code blocks, or hierarchical plain text. Right-edge spaces can be meaningful in a few markup formats. Review these formats before applying the result.

Treat tabs, line breaks, and empty lines separately

A tab is not merely a fixed number of spaces. It advances to an editor-defined tab stop and can also act as a delimiter in tab-separated data. Use Remove Tabs when you need to delete tabs, replace them with a fixed string, or expand them while respecting column position. Do not remove tabs blindly from TSV data or indentation-sensitive code.

Line endings create stored lines. Use Remove Line Breaks when copied text has hard wraps, and choose a paragraph-preserving mode only when blank lines reliably mark real paragraph boundaries. Use Remove Empty Lines when the problem is vertical gaps rather than joined text.

Check for NBSP and other Unicode whitespace

Not every blank-looking character is a regular space. U+00A0 NO-BREAK SPACE can keep nearby text on one line, while U+202F NARROW NO-BREAK SPACE and U+2007 FIGURE SPACE can carry typography or numeric alignment. If text looks normal but wrapping or exact comparison fails, read the Non Breaking Space guide and use the character-specific tool before changing everything.

Zero width space, word joiner, join controls, and a byte order mark require another decision. Some can affect script shaping or emoji sequences. Diagnose them with the zero-width character audit instead of grouping every invisible code point under “space.”

A practical decision workflow

  1. Preserve the source. Broad deletion is difficult to reverse because the original boundaries disappear.
  2. Identify the scope. Decide whether the problem affects every line, only line edges, repeated runs, or one character category.
  3. Audit before changing. Counts for regular spaces, tabs, no-break spaces, other Unicode spacing, and stored lines reveal what the input actually contains.
  4. Use the narrowest transformation. Prefer a character-specific or structure-specific tool when it can solve the confirmed problem.
  5. Test a representative sample. Include the most complex line, not only an easy example.
  6. Compare in the destination. Paste the result into the form, editor, spreadsheet, or system where it will be used.

Good candidates for all-space removal

  • A controlled identifier with a no-space rule.
  • A value whose separators are known to be cosmetic.
  • Test data where joined output is explicitly required.
  • A short sample that can be checked character by character.

Content that needs extra care

  • Prose, names, postal addresses, and multilingual text.
  • Source code, Markdown, YAML, and fixed-width layouts.
  • CSV, TSV, tables, and structured imports.
  • Dates, units, product codes, and localized numbers.

Frequently asked questions

How do I delete spaces but keep line breaks?

Choose All Spaces on the main tool. It removes supported horizontal whitespace while preserving stored line breaks. Review the result because content within each line will be joined.

How do I remove extra spaces only?

Choose Multiple Spaces. It collapses each supported horizontal whitespace run to one regular space, trims line edges, and preserves line breaks.

Why are spaces still visible after replacement?

The input may contain tabs, NBSP, typographic Unicode spaces, zero-width controls, or layout generated by the destination application. Use the audit to identify the stored category before choosing another transformation.

Can I safely remove whitespace from code?

Not with a broad text cleanup. Whitespace can separate tokens, define indentation, or preserve literal output. Use a language-aware formatter or a narrowly scoped change and test the code afterward.

Reference

The WHATWG Infra Standard distinguishes stripping and collapsing whitespace from removing separators entirely. Its defined ASCII operation replaces a run with one U+0020 and then trims the edges—a useful model for understanding why “collapse” and “delete all” produce different results. See strip and collapse ASCII whitespace.