Spreadsheet Practice

How to remove HTML tags from text in Google Sheets

Google Sheets formula

=TRIM(SUBSTITUTE(REGEXREPLACE(A2,"<[^>]+>"," "),"&amp;","&"))

Replace every tag with a space using REGEXREPLACE, then tidy up: =TRIM(SUBSTITUTE(REGEXREPLACE(A2,"<[^>]+>"," "),"&amp;","&")).

Result on the example
one result per row in B2, filled down to B6
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 &amp; entity back into &, and TRIM removes the extra spaces.

=TRIM(SUBSTITUTE(REGEXREPLACE(A2,"<[^>]+>"," "),"&amp;","&"))

Result"Oak desk, 140 cm"

  1. A2"<p>Oak desk, <b>140 cm</b></p>"

    The value in A2.

  2. REGEXREPLACE(A2,"<[^>]+>"," ")" Oak desk, 140 cm "

    REGEXREPLACE: Replaces every match. Use $1 for a captured group.

    • textA2"<p>Oak desk, <b>140 cm</b></p>"
    • regular_expression"<[^>]+>"
    • replacement" "
  3. SUBSTITUTE(REGEXREPLACE(A2,"<[^>]+>"," "),"&amp;","&")" Oak desk, 140 cm "

    SUBSTITUTE: Replaces matching text.

    • textREGEXREPLACE(A2,"<[^>]+>"," ")" Oak desk, 140 cm "
    • old_text"&amp;"
    • new_text"&"
  4. TRIM(SUBSTITUTE(REGEXREPLACE(A2,"<[^>]+>"," "),"&amp;","&"))"Oak desk, 140 cm"

    TRIM: Removes extra spaces, leaving single spaces between words.

    • textSUBSTITUTE(REGEXREPLACE(A2,"<[^>]+>"," "),"&amp;","&")" Oak desk, 140 cm "

In Excel

Excel 365 has REGEXREPLACE, and the same formula works there. In older versions, use Find and Replace with <*> in Find and nothing in Replace (the * is a wildcard).

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=REGEXREPLACE(A2,"<[^>]+>","")Oak desk, 140 cm, Ships in 2 days, No tags here…Different resultDeletes the tags without adding spaces or decoding entities. "SteelBlack", and the "&amp;" entity stays as it is.

Common mistakes

  • Other entities, like &nbsp; and &quot;, 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

In B2, strip the HTML tags from the description, turn &amp; 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.