WebToolsPlanet
Converter Tools

HTML to Base64

Paste HTML markup and get the Base64-encoded string in one click.

Last updated: May 29, 2026

Client-Side Processing
Input Data Stays on Device
Instant Local Execution

Find this tool useful? Support the project to keep it free!

Buy me a coffee

What is HTML to Base64?

HTML to Base64 encodes an HTML document or fragment as a Base64 string. Common uses include embedding HTML in a data URI for an iframe src, passing HTML through an API that only accepts Base64 payloads, or storing an HTML template as a Base64 value in a configuration file.

How to Use HTML to Base64

1

Paste your HTML into the input.

2

Click "Encode to Base64".

3

Toggle URL-safe if needed.

4

Copy the output.

Common Use Cases

  • Embedding an HTML snippet in an iframe srcdoc or data URI: <iframe src="data:text/html;base64,...">.
  • Sending HTML content through a webhook or API that requires Base64 encoding.
  • Storing an email HTML template as a Base64 value in a database or config.

Example Input and Output

Encoding an HTML fragment to Base64.

HTML
<h1>Hello World</h1>
Base64
PGgxPkhlbGxvIFdvcmxkPC9oMT4=

Privacy

All encoding runs in your browser. No data is sent to any server.

Frequently Asked Questions

Will angle brackets and special characters encode correctly?
Yes. Base64 encodes the raw bytes, so all characters including <, >, &, and Unicode are preserved exactly.
Can I embed the result in an iframe?
Yes: <iframe src="data:text/html;base64,PGgxPkhlbGxvIFdvcmxkPC9oMT4="></iframe> will render the HTML. Note that sandboxing rules apply.