Guides/Create content/Code/Add custom HTML

Add custom HTML

Last reviewed on March 18, 2026

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

Before you begin, the Custom HTML block is designed for adding supported HTML code directly to your page. If you’re looking to do something else, these guides may help:

Add the Custom HTML block

To add the Custom HTML block, follow these steps:

  1. Go to your site’s dashboard and select the page, post, or template you want to add the HTML to.
  2. Click the + block inserter icon and search for “HTML”.
  3. Click the Custom HTML block to add it to your content.
A box drawn around the Custom HTML block in the block selector.

For more information, visit our detailed instructions on adding blocks.

Add your HTML

Once you’ve added the block, follow these steps to add your HTML code:

  1. Click the “Edit HTML” button.
The HTML block with an Edit HTML button.
  1. 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.
  2. When you’re satisfied, click the Update button to save your changes.
The HTML editor with code on the left and a preview on the right.

You will see the result of your HTML code in the editor. To make changes, click the “Edit HTML” button in the block toolbar.

Supported HTML

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.

Troubleshoot common issues

If your HTML code does not appear as expected after saving, check the following common causes.

Code disappears after saving

WordPress.com filters certain HTML tags for security. Tags like iframe, script, style, form, and embed require a paid plan with hosting features activated.

If your code disappears or is partially removed after you save:

  1. Confirm you have a paid WordPress.com plan (Personal, Premium, Business, or Commerce).
  2. Go to Hosting → Overview in your site’s dashboard and verify that hosting features are active. Learn how to activate your plan.
  3. Re-enter your code in the Custom HTML block and save again.

On a free plan, these tags are automatically removed when you save. Upgrade to any paid plan to use them.

Embed third-party content without custom code

If you want to embed content from a service like YouTube, Google Maps, Spotify, or a social media platform, use the Embed block instead. The Embed block works on all plans and does not require you to write HTML.

Resolve “unexpected or invalid content” errors

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.

Was this guide helpful for you?

Not quite what you're looking for? Get Help!

Copied to clipboard!