How to encode HTML to Base64 and decode Base64 to HTML
- HTML to Base64: type, paste, or open an HTML document on the left and choose between a
data:text/html;base64,Data URI, raw Base64, or a ready-to-embed<iframe src="data:text/html;base64,...">tag. - Base64 to HTML with sandboxed preview: paste Base64, a
data:text/html;base64,URI, or an<iframe>snippet on the right to decode the markup and inspect it inside a script-disabled sandboxed preview frame.
Frequently asked questions
- Why do browsers block pasting a data:text/html;base64,... URI into the address bar?
- Modern browsers block top-level navigation to data:text/html URLs to prevent phishing attacks. However, embedding a data:text/html;base64,... URI inside an <iframe src="data:text/html;base64,..."> continues to work across browsers.
- Is the live HTML preview safe when decoding untrusted Base64?
- Yes. The preview uses <iframe sandbox="" srcdoc="..."> with an empty sandbox attribute, which strictly disables JavaScript execution, form submission, popups, and access to the parent page.
- Does the HTML encoder preserve UTF-8 characters and emojis?
- Yes. Markup is encoded as UTF-8 bytes before Base64 conversion, so non-ASCII text, symbols, and emojis round-trip without needing HTML entity escapes.