How to remove HTML tags from text in Google Sheets
Google Sheets formula
=TRIM(SUBSTITUTE(REGEXREPLACE(A2,"<[^>]+>"," "),"&","&"))Replace every tag with a space using REGEXREPLACE, then tidy up: =TRIM(SUBSTITUTE(REGEXREPLACE(A2,"<[^>]+>"," "),"&","&")).
- Result on the example
- one result per row in
B2, filled down toB6 - Excel
- See below
See it work
The formula is already in B2, filled down to B6. Change any input and the result updates, or edit the formula to experiment.
How it works
The pattern <[^>]+> matches a <, then anything that isn't a >, then the >: one whole tag. Replacing each tag with a space, rather than nothing, keeps words from list items apart ("Steel Black", not "SteelBlack"). SUBSTITUTE turns the & entity back into &, and TRIM removes the extra spaces.
=TRIM(SUBSTITUTE(REGEXREPLACE(A2,"<[^>]+>"," "),"&","&"))Result"Oak desk, 140 cm"
A2"<p>Oak desk, <b>140 cm</b></p>"The value in A2.
REGEXREPLACE(A2,"<[^>]+>"," ")" Oak desk, 140 cm "REGEXREPLACE: Replaces every match. Use $1 for a captured group.- text
A2"<p>Oak desk, <b>140 cm</b></p>" - regular_expression
"<[^>]+>" - replacement
" "
- text
SUBSTITUTE(REGEXREPLACE(A2,"<[^>]+>"," "),"&","&")" Oak desk, 140 cm "SUBSTITUTE: Replaces matching text.- text
REGEXREPLACE(A2,"<[^>]+>"," ")" Oak desk, 140 cm " - old_text
"&" - new_text
"&"
- text
TRIM(SUBSTITUTE(REGEXREPLACE(A2,"<[^>]+>"," "),"&","&"))"Oak desk, 140 cm"TRIM: Removes extra spaces, leaving single spaces between words.- text
SUBSTITUTE(REGEXREPLACE(A2,"<[^>]+>"," "),"&","&")" Oak desk, 140 cm "
- text
In Excel
Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =REGEXREPLACE(A2,"<[^>]+>","") | Oak desk, 140 cm, Ships in 2 days, No tags here…Different result | Deletes the tags without adding spaces or decoding entities. "SteelBlack", and the "&" entity stays as it is. |
Common mistakes
- Other entities, like and ", need their own SUBSTITUTE.
- Text inside <script> or <style> blocks isn't a tag and stays in the result.
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Remove HTML tags from text
B2, strip the HTML tags from the description, turn & back into &, and tidy the spaces. Fill down to B6.Questions
How do I keep line breaks from <br> tags?
Replace them first: =REGEXREPLACE(A2,"<br\s*/?>",CHAR(10)), then strip the rest.
How do I extract a link's address?
Capture the href: =REGEXEXTRACT(A2,"href=""([^""]+)""").
Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine.