Updated on July 11, 2026medium, ~10 min

How to Embed HTML in Notion (Code, iframes & Widgets)

Notion has no HTML block, so pasting code onto a page just gives you text. To embed HTML in Notion, put the file at a public URL first — GitHub Pages, Netlify, or any static host works — then type /embed on your Notion page, paste that URL, and click "Embed link". Notion loads the page inside the block, and any JavaScript in it runs. If someone gave you <iframe> embed code, you don't need to host anything: copy the URL out of the src="..." attribute and embed that.

Why embed HTML in Notion?

  • Run a custom widget, chart, or mini-app that Notion's blocks can't build.
  • Reuse an HTML/CSS/JS snippet you already have instead of rebuilding it in another tool.
  • Keep one hosted file as the source of truth and show it on several Notion pages at once.

How to embed HTML in Notion

  1. Know what Notion actually accepts

    A Notion /embed block takes a URL, never raw code. Pasting <div> or <iframe> markup onto a page produces plain text. So the job splits in two: get your HTML onto the web at its own address, then hand Notion that address.

  2. Already have iframe embed code? Extract the URL

    Snippets from other services look like <iframe src="https://example.com/embed/abc">. Copy only the URL between the quotes after src= and skip straight to the last step — no hosting needed.

  3. Host your own HTML file for free

    For a file you wrote yourself, GitHub Pages is the sturdiest free option: create a repository, upload index.html, and enable Pages in the repository settings to get a permanent https URL. Netlify's drag-and-drop deploy is faster if you don't use GitHub. Any static host works as long as the final URL is https.

  4. Embed the URL in Notion

    On your Notion page type /embed, press Enter, paste the URL, and click "Embed link". The page renders inside the block; drag the handles to size it. Your CSS and JavaScript run as normal inside the frame.

  5. Just want to show the code, not run it?

    Use a code block instead: type /code, pick HTML from the language menu, and paste. Notion syntax-highlights it for readers without rendering anything.

Good to know

  • The URL must be https — Notion won't render plain http pages inside an embed.
  • The host has to allow framing. A page that sends X-Frame-Options: DENY or a restrictive Content-Security-Policy shows up as an empty box. GitHub Pages and Netlify allow framing by default.
  • Browsers restrict cookies and localStorage inside embedded frames, so HTML that depends on logins or saved state can behave differently in Notion than in a normal tab.
  • Notion caches embeds briefly — after you update the hosted file, reload the Notion page (and allow for your host's own cache) before assuming something broke.

Frequently asked questions

Can I paste HTML code directly into Notion?

No. Notion renders pasted markup as plain text. The only way to display raw code is a /code block, and the only way to run HTML is hosting it at a URL and embedding that URL.

Does Notion have an HTML block or widget?

No. Notion's blocks are its own formats plus the /embed block, which loads an external URL in an iframe. Everything people call an "HTML widget" in Notion is a hosted page embedded this way.

How do I embed an iframe in Notion?

Take the URL from the iframe's src attribute and paste it into a /embed block. Notion builds its own iframe around that URL — it never accepts the <iframe> tag itself.

Where can I host HTML for a Notion embed for free?

GitHub Pages and Netlify both have free tiers with https URLs that allow framing. GitHub Pages suits files you'll keep updating from a repository; Netlify's drag-and-drop deploy is quicker for one-off files.

Why does my embedded HTML page show a blank box?

Usually one of three things: the URL is http instead of https, the host blocks framing with X-Frame-Options or CSP headers, or the file path is wrong and the URL 404s. Open the URL in a normal browser tab first — if it loads there but not in Notion, it's a framing header.

Does JavaScript work inside a Notion embed?

Yes. Scripts in your hosted page run inside the embed frame — clocks, charts, and interactive widgets all work. The main caveat is restricted cookie and storage access, which affects pages that need a login.

Is there a way to skip the hosting step?

If the goal is a widget rather than a specific file, our AI widget maker generates the HTML from a plain-English description and hosts it for you — you get a ready embed link for Notion without touching GitHub or Netlify.

Need a widget that doesn’t exist yet?

Describe it in plain English and generate a custom Notion widget with a stable embed link — no code required.

Create a widget