EditMyHTML

Remove non-breaking spaces ( ) from HTML

Text can contain regular and non-breaking spaces even though they look the same at first glance. Non-breaking spaces prevent a line break at their position. This can be intentional, but copying can also introduce unexpected spacing.

Open the free HTML text editor

Regular spaces and  : the difference

A regular space separates words; the browser can usually break the line there.   is an HTML representation of a non-breaking space, Unicode U+00A0. The same character can also appear as  , as   or directly as a Unicode character in the text.

Non-breaking spaces can appear when copying from formatted documents, emails or web pages, for example. Some programs use them to control spacing. They can therefore occur in text without you deliberately entering them.

When non-breaking spaces are useful

With a number and unit, such as “100 ml”, a non-breaking space can keep both parts on the same line. This may also be useful for certain abbreviations or names. A non-breaking space is therefore not an HTML error.

When they make content maintenance harder

Unintended occurrences can prevent groups of words from wrapping. Multiple non-breaking or regular spaces in a row are also sometimes used to force a visual gap. Suitable styles are usually better for a website's layout than these character sequences.

How EditMyHTML handles these characters

EditMyHTML replaces the supported representations of non-breaking spaces in visible text with regular spaces. Multiple consecutive regular spaces are reduced to one. This cleanup is part of the existing processing and has no separate on/off switch.

Before

<p>Care&nbsp;&nbsp;for  every day.</p>

After text cleanup

<p>Care for every day.</p>

The example concerns the text between tags. This cleanup does not treat HTML tags and their attributes as ordinary visible text. It is not a blanket find-and-replace operation across every character of the source code.

Limits and important special cases

Automatic cleanup does not distinguish whether you inserted a non-breaking space intentionally. An intended non-breaking pair such as “100 ml” can therefore lose its protection from line breaks. If your target system requires these pairs, restore them there after the final edit and check how they appear.

Other whitespace characters, such as the narrow no-break space (U+202F), are not all covered by this behavior. For source code, preformatted content or other spacing-sensitive text, do not rely on the number of spaces staying unchanged. EditMyHTML is intended for text editing and has no general mode for preserving every whitespace character exactly.

A controlled workflow

  1. Keep the source code outside the editor.
  2. Paste the HTML content on the left and check the visible text on the right.
  3. Pay particular attention to number–unit pairs and deliberately added spacing.
  4. Check the HTML and transfer the finished version to your target system.
  5. Check the final line wrapping there on wide and narrow screens.

Literal HTML preservation for safe text changes does not disable the existing space cleanup. When cleanup takes effect, it is already an intentional text change.