EN
My tools

File to Base64 Converter (Data URI)

Convert any file to Base64 in your browser: raw Base64, a data URI with the right MIME type, Base64URL or PEM/MIME line wrapping, plus CSS, HTML and JSON snippets.

Any file type, up to 50 MB each. Nothing is uploaded.
My tools →
Advertisement

Base64 turns any file into plain text so it can travel inside JSON, HTML, CSS, e-mail or configuration files. This converter reads files in your browser and writes them as raw Base64, as a data URI with the right MIME type, as unpadded Base64URL, or wrapped at 64 or 76 characters for PEM and MIME, with optional CSS, HTML and JSON snippets. Several files can be converted at once.

How to use this tool

  1. Choose one or more files.
  2. Pick the output form: a data URI to embed in a page, raw Base64 for APIs, or wrapped lines for PEM and e-mail.
  3. Optionally choose a snippet such as an <img> tag or a CSS url().
  4. Copy the text, or download it when it is too long to display.

Formula

Base64 length = 4 × ⌈bytes ÷ 3⌉ characters; a data URI adds "data:" + MIME type + ";base64,".

Every 3 bytes become 4 characters from A–Z, a–z, 0–9, + and /, with = padding at the end. Base64URL uses - and _ instead of + and / and drops the padding, so it is safe in URLs and file names.

Example

The 26-byte text file "Hello world.\nSecond line.\n" becomes SGVsbG8gd29ybGQuClNlY29uZCBsaW5lLgo= — 36 characters, 38.5% larger — and as a data URI data:text/plain;base64,SGVsbG8gd29y…Lgo=.

Frequently asked questions

When should I embed a file as a data URI?

For small icons, fonts or images under a few kilobytes it saves a request. For larger files a normal URL is better: Base64 is a third bigger and cannot be cached separately from the page.

Is Base64 encryption?

No. Anyone can decode it instantly. It only makes binary data safe to put in text.

Are my files uploaded?

No. The file is read and encoded by the page in your browser.

Sources

Last updated:

Cite or embed this tool
APA

kakaoCalc. (2026, November 8). File to Base64 Converter (Data URI). https://kakao.mobile/tools/file-to-base64-converter/

MLA

“File to Base64 Converter (Data URI).” kakaoCalc, 8 Nov. 2026, kakao.mobile/tools/file-to-base64-converter/.

Advertisement