Updated on October 22, 2026medium, ~10 min
How to Embed HTML in Notion (Code, iframes & Widgets)
Since July 2026 Notion has an HTML block: type /html, choose Upload HTML file, and Notion runs your HTML, CSS and JavaScript in a sandboxed frame. Calls to outside services are blocked, and pasting code as plain text still just gives you text. For code that needs live data, or to reuse one file across pages, put the file at a public URL (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.
Notion iframe embeds: what the block will and won't accept
This is the detail that trips most people up. Notion has two blocks for this: /html runs a file you upload (no outside network calls), and /embed accepts only a URL, so pasting an <iframe> tag or code into /embed does nothing. For a self-contained snippet, upload it with /html; for anything that needs the web, host it and embed its address. The steps below cover the free hosting routes.
How to embed HTML in Notion
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.
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.
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.
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.
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 you embed HTML in Notion?
Yes, two ways. Upload an .html file with /html and Notion runs it on the page, without access to outside services. Or host the file on GitHub Pages, Netlify, or a similar free service and embed the link with /embed, which also lets it load live data. Raw HTML or an iframe tag pasted onto a page will not render.
Can I paste HTML code directly into Notion?
Not as text. Save it as an .html file and upload it with /html (or /embed, then the Upload tab). It runs, but it can't reach outside services. To show code without running it, use a /code block.
Does Notion have an HTML block or widget?
Yes, since July 2026. Type /html and choose Upload HTML file, or Create with AI to have Notion write the code. The block runs your HTML and JavaScript but blocks calls to outside services, so widgets that need live data (weather, calendars, sync) are still hosted pages embedded with /embed.
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?
For a self-contained file, yes: upload it with /html. 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, so 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