How to Remove HTML Tags from HubSpot Properties
You've just imported 5,000 contacts from another CRM and everything looks fine — until you open a contact record and see this in the notes or description field:
<p>Spoke with John about the <strong>enterprise</strong> plan.<br />He mentioned their team is "very interested" in Q2.</p>
Or worse, you find HTML fragments scattered through otherwise normal text properties:
Acme Corporation&nbsp;- West Division
123 Main St<br>Suite 200<br>Chicago, IL 60601
HTML artifacts in HubSpot properties are a common problem after data migrations, imports from web-based systems, or integrations that don't properly strip markup before writing to the CRM.
Below is an example of stripping HTML tags from a property in a single pass:
Where HTML artifacts come from
CRM migrations. When you migrate from Salesforce, Pipedrive, Zoho, or any other CRM, rich text fields often export with their HTML formatting intact. The source system displayed the HTML as formatted text; the export dumps the raw markup. If you import that raw export into HubSpot without cleaning it, every <p>, <br>, and <strong> tag comes along for the ride.
Web scraping or enrichment tools. Tools that pull company descriptions, bios, or other text from websites sometimes capture the HTML structure along with the content.
Integration syncs. Bidirectional syncs between HubSpot and other platforms can introduce HTML when the source system stores rich text and the integration doesn't convert it to plain text.
Copy-paste by reps. Sales reps copying text from websites, emails, or documents into HubSpot fields sometimes inadvertently paste HTML source instead of plain text. This is especially common with browser-based paste operations.
HubSpot's own rich text fields. Some HubSpot properties support rich text (like certain custom multi-line text fields). If data from one of these fields gets copied or synced to a plain text field, the HTML tags become visible.
Common HTML artifacts you'll encounter
Not all HTML contamination looks the same. Here's what you'll typically find:
Structural tags: <p>, </p>, <br>, <br />, <div>, </div>. These define paragraphs and line breaks. In a plain text property, they display as literal text instead of creating visual formatting.
Formatting tags: <strong>, <em>, <b>, <i>, <u>, <span>, <font>. These were meant to bold, italicize, or style text. Now they're just clutter.
HTML entities: & (ampersand), (non-breaking space), " (quotation mark), < (less than), > (greater than), ' (apostrophe). These are encoded characters that should have been decoded back to their plain text equivalents.
Link tags: <a href="https://example.com">Click here</a>. The URL and link text are useful information, but the tags are not.
List markup: <ul>, <ol>, <li>. Ordered and unordered list elements that were formatting a structured list.
Table markup: <table>, <tr>, <td>. Occasionally you'll find entire table structures embedded in a text property, usually from a particularly messy migration.
Style and class attributes: <span style="color: red;">, <div class="note">. These carry over styling information that has no meaning outside the original context.
Cleaning strategy
HTML cleanup requires a layered approach. You can't just delete everything between < and > in a single pass — that might work for simple cases but will mangle data that legitimately contains angle brackets (like mathematical comparisons or code snippets in a tech company's CRM).
Work through these layers in order:
Layer 1: Remove common structural tags
Start with the tags that appear most frequently and are always safe to remove.
Line break tags: Search for <br\s*/?> and replace with a space (or nothing, depending on whether you want the text to run together). This matches <br>, <br/>, and <br />.
Paragraph tags: Search for </?p> and replace with nothing. The /? makes the slash optional, matching both opening <p> and closing </p> tags.
Div tags: Search for </?div> and replace with nothing.
Layer 2: Remove formatting tags
These are safe to remove in virtually all cases.
Bold and italic: Search for </?(?:strong|em|b|i|u)> and replace with nothing. This single pattern matches opening and closing tags for strong, em, b, i, and u elements.
Span and font tags: These are trickier because they often have attributes. Search for </?span[^>]*> and </?font[^>]*> and replace with nothing. The [^>]* matches any attributes inside the tag.
Layer 3: Handle link tags
For <a> tags, you have a choice. You can strip them entirely (removing both the tag and the URL), or you can extract the URL and keep it as plain text.
Strip completely: Search for <a[^>]*>(.*?)</a> and replace with $1. This keeps the link text but removes the tag and URL.
Keep the URL: Search for <a[^>]*href="([^"]*)"[^>]*>(.*?)</a> and replace with $2 ($1). This converts <a href="https://example.com">Click here</a> to Click here (https://example.com).
Layer 4: Decode HTML entities
After removing tags, decode the entities.
| Search | Replace |
|---|---|
& | & |
| (space) |
" | " |
< | < |
> | > |
' | ' |
' | ' |
Run these in order. Do & last if you suspect double-encoding — some data has &amp; which should become & first, then & on the second pass.
Layer 5: Catch remaining tags
After the targeted passes, run a broad sweep: search for <[^>]+> to find any remaining HTML tags. Preview this carefully before applying — it will also match legitimate angle bracket usage if any exists in your data.
Doing it in SearchReplace
The workflow maps directly to the layers above. For each layer, select the property (or properties) affected, enter the search regex, set the replacement, and preview.
The preview step is especially valuable for HTML cleanup because some of these regex patterns are broad. You need to verify that:
- You're not stripping content that happens to be between angle brackets but isn't HTML
- HTML entities are decoding to the correct characters
- The cleaned text reads naturally without the markup
A typical HTML cleanup for a 10,000-contact import takes 10-15 search-and-replace operations spread across the layers described above. With previews, you can work through this in under an hour.
If something doesn't look right after applying a replacement, roll back that specific operation. Each operation in SearchReplace is independent — rolling back the entity decoding step doesn't undo the tag removal step.
Which properties to check
HTML artifacts tend to concentrate in certain property types:
- Multi-line text fields — description, notes, comments
- Address fields — especially if the source system used
<br>for line breaks - Company description — often pulled from websites
- Custom text properties — anything that was free-text in the source system
Single-line fields like first name and email are less likely to have HTML, but it's worth a quick check. A search for < across all your properties will quickly reveal which ones are affected.
Preventing HTML contamination
Clean before you import. Strip HTML from your CSV files before importing into HubSpot. Most spreadsheet tools can do this with a REGEXREPLACE formula, and scripting languages make it trivial with libraries like Python's BeautifulSoup or Node's striptags.
Configure integration mappings. When setting up a sync between HubSpot and another system, check whether rich text fields in the source map to plain text fields in HubSpot. If they do, add a transformation step in your integration tool to strip HTML.
Use appropriate field types. HubSpot has rich text custom properties for use cases that need formatting. If a property legitimately needs to support bold text and links, make it a rich text field. Don't store HTML in plain text fields and expect it to look right.
Monitor new data. After a migration or integration setup, spot-check records for HTML artifacts within the first week. It's much easier to fix the source of contamination early than to clean up months of accumulated markup.
HTML in CRM properties is one of those problems that makes your team look sloppy when it surfaces in emails, exports, or customer-facing displays. A structured cleanup pass catches it all, and good import hygiene prevents it from returning.
Keep working through the cleanup
Related HubSpot guides for planning, previewing, and validating the next step.
Annual HubSpot Data Review: The Complete Checklist
A comprehensive checklist for reviewing your HubSpot data at the end of the year. Covers contacts, companies, deals, properties, integrations, and compliance.
Read guideHow to Clean Up Company Names in HubSpot
Inc vs Inc., LLC vs L.L.C., extra spaces and inconsistent suffixes — here's how to standardize company names in your HubSpot CRM for cleaner data and better reporting.
Read guideHow to Fix HubSpot Import Errors After a Bad CSV Upload
A bad CSV import can corrupt thousands of HubSpot records in minutes. Here's how to identify the damage, fix it, and prevent it from happening again.
Read guideHow to Clean Up Job Titles in HubSpot
Job titles in your HubSpot CRM are probably a mess — VP, V.P., Vice President all mean the same thing. Here's how to standardize them for better segmentation and lead scoring.
Read guideStill editing HubSpot records one by one?
Start with 100 free applied records — no credit card required.