---
title: "Why does my blog's HTML have hidden '&nbsp;' characters before every link?"  
description: "Why does my blog's HTML have hidden '&nbsp;' characters before every link?"  
author: "Anubhav Sharma"  
published: 2026-09-10  
updated: 2026-09-10  
canonical: https://www.mindstick.com/forum/162154/why-does-my-blog-s-html-have-hidden-nbsp-characters-before-every-link  
category: "troubleshooting"  
tags: ["html", "troubleshooting"]  
reading_time: 2 minutes  

---

# Why does my blog's HTML have hidden '&nbsp;' characters before every link?

Why does my blog's HTML have hidden ' ' characters before every link, and how do I clean them all at once?

## Replies

### Reply by Manish Kumar

If you are pasting content into a CMS editor from Word, Google Docs, or even another web page, this is almost guaranteed to happen. Rich-text editors love to insert non-breaking spaces to preserve the spacing they see, and they hide them inside the HTML where you will never spot them in the visual view. The result is odd gaps before links, broken underline alignment, and sometimes an extra space that pushes a link onto a new line.

First, prove it to yourself. Open the post in the source or 'code' view and search for <a. You will usually find dozens. It can also appear as the literal character U+00A0, which looks like a normal space in most editors, so search for both.

For one post, a careful find-and-replace in the source view works. For hundreds of posts, do it programmatically. Export the content (many CMSs give you an XML export), load it with a parser rather than regex if the structure is complex, and replace both the entity and the raw character with a normal space, then collapse doubled spaces. In Python, something like text.replace('\u00a0', ' ').replace(' ', ' ') before a re.sub(r' {2,}', ' ', text) gets most of it.

Then fix the source of the problem: paste into the editor using 'paste as plain text' (Ctrl+Shift+V in most editors) and add links afterwards. Prevention beats cleanup every time.


---

Original Source: https://www.mindstick.com/forum/162154/why-does-my-blog-s-html-have-hidden-nbsp-characters-before-every-link

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
