Use the Custom HTML block to add HTML code and preview it as you edit it. This guide will show you how to use this block to add code to your website.
Before you begin, the Custom HTML block is for adding raw HTML code to a single page or post. It’s not always the right tool. If your goal matches one of the cases below, the linked guide is a faster route:
- Embed a video, map, social post, or third-party service (YouTube, Spotify, Instagram, Giphy, Pinterest, and many others): see Embed content from other platforms. The Embed block works on every plan and supports many popular services without any custom code.
- Collect contact details, signups, or feedback: see Form block. The Form block builds a working form without HTML.
- Add CSS styling to your site: see Add custom CSS.
- Add code to your site’s headers (verification meta tags, third-party scripts that load site-wide): see Add code to headers.
To add the Custom HTML block, follow these steps:
- Go to your site’s dashboard and select the page, post, or template you want to add the HTML to.
- Click the + block inserter icon and search for “HTML”.
- Click the Custom HTML block to add it to your content.

For more information, visit our detailed instructions on adding blocks.
Once you’ve added the block, follow these steps to add your HTML code:
- Click the “Edit HTML” button.

- Write or paste your HTML code on the left side of the editor.
- As you compose your HTML, you will see a preview of the code on the right side.
- When you’re satisfied, click the Update button to save your changes.

You will see the result of your HTML code in the editor. To make changes, click the “Edit HTML” button in the block toolbar.
HTML is a computer language that tells browsers how to display website content. WordPress.com allows the following HTML tags on all plans:
- a
- address
- abbr
- acronym
- area
- article
- aside
- b
- big
- blockquote
- br
- caption
- cite
- class
- code
- col
- del
- details
- dd
- div
- dl
- dt
- em
- figure
- figcaption
- footer
- font
- h1, h2, h3, h4, h5, h6
- header
- hgroup
- i
- img
- ins
- kbd
- li
- map
- mark
- ol
- p
- pre
- q
- rp
- rt
- rtc
- ruby
- s
- section
- small
- span
- strike
- strong
- sub
- summary
- sup
- table
- tbody
- td
- tfoot
- th
- thead
- tr
- tt
- u
- ul
- var
To add the following tags, you will need a paid plan with hosting features activated. Learn how to activate your plan’s hosting features.
embed, frame, iframe, form, input, object, textarea, script, style, link
For more information on the types of code you can add to your website, as well as alternatives when a type of code is not supported, visit our guide on adding code to your website.
If your HTML code does not appear as expected after saving, check the following common causes.
WordPress.com filters certain HTML tags for security. Tags like iframe, script, style, form, embed, and object require a paid plan with hosting features activated.
If your code disappears or is partially removed after you save, work through these checks in order:
- Check your plan. Go to your site’s dashboard and select Upgrades → Plans. The Custom HTML block accepts restricted tags only on a paid plan. If you’re on the free plan, upgrade to any paid plan to continue.
- Activate hosting features. A paid plan alone is not enough — hosting features must also be active. Install at least one plugin on your site to activate your plan to accept custom code.
- Re-enter your code. Once your plan is paid and hosting features are active, paste the code into the Custom HTML block again and save.
If your code is still removed after activating hosting features, the tag may not be supported in this context, or the third-party service may publish embed code that uses unsupported markup. Try the Embed block instead, or see Resolve “unexpected or invalid content” errors below.
If you’re trying to embed content from a third-party service — videos, music, maps, social posts, calendars, newsletters, or document viewers — use the Embed block instead. The Embed block works on every plan, does not require you to write HTML, and supports services such as YouTube, Vimeo, Spotify, X, Instagram, TikTok, and many others.
If the Embed block does not list your service, the service likely needs an iframe or script. Add the embed code to a Custom HTML block on a paid plan with hosting features activated.
If you see a message that says your block contains unexpected or invalid content, the HTML in the block may be malformed or may have changed. Select “Attempt Block Recovery” to let the editor fix the issue automatically. If the error persists, see our guide on resolving block errors for additional options.