Base64 encode text or a file in the browser

Create data URLs for small assets and understand why Base64 makes files larger.

Privacy-first — processing mode is labeled on each tool page2026-11-17

Base64 turns binary data into text so it can travel through JSON, HTML or an email. It is convenient for small assets and a poor choice for large ones because the encoded text is bigger.

Tool used in this guide

Base64 encoder / decoder

Open tool

How to use it

  1. 1

    Decide whether you need Base64 at all

    Use it for a small inline icon, a test fixture or an API that requires a text field. For a normal image served over HTTP, a file URL is smaller and cacheable.

  2. 2

    Encode the text or file

    Paste text for a quick token, or choose a small file to produce a data URL. Check the MIME type in the prefix; a wrong type can make a browser refuse to render the asset.

  3. 3

    Watch the size increase

    Base64 is roughly 33% larger than the raw bytes before compression. For a 5 KB icon that is fine; for a 5 MB video it is the wrong tool.

  4. 4

    Decode and verify

    Round-trip the output through the decoder and compare the text or file. For binary data, open the decoded file rather than trusting the preview alone.

Use the tool for this task

Base64 encoder / decoder

Encode and decode UTF-8 text or files as Base64, including URL-safe output.

Open tool

Frequently asked questions

Is Base64 encryption?

No. It is an encoding; anyone can decode it. Do not use Base64 to protect passwords or secrets.

Why is my data URL not displaying?

Check the MIME type, the comma after the prefix, and whether the string was truncated. A missing padding character can also make decoding fail.

Related tools