TOOLS.GAMESLOOP234 Free Online Tools

Convert a File to Base64

Encode any file as Base64 or a data URI.

What does File to Base64 Converter do?

Convert any file — image, font, PDF, audio — into Base64 or a complete data URI for embedding in CSS, JSON, HTML or an API payload. The MIME type is detected automatically from the file itself.

How to Use File to Base64 Converter

  1. 1
    Select a fileAny type, any size within reason.
  2. 2
    Choose an output formatRaw Base64, data URI, CSS or HTML.
  3. 3
    Copy or downloadLarge results are easier to download.

Key Features

  • Any file type, with the MIME type detected from the content
  • Raw Base64 or a complete data URI
  • CSS and HTML snippets generated for common asset types
  • Encoded size shown, including the 33% overhead
  • Warning when the result is too large to be worth inlining
  • Download the Base64 as a text file for very large results

Frequently Asked Questions

When should I inline a file as Base64?

Only for small assets — icons and tiny graphics under a few kilobytes. Inlining removes a request but the data cannot be cached separately and is 33% larger, so it hurts more than it helps beyond that.

Why is the Base64 larger than my file?

Because Base64 represents three bytes as four ASCII characters. The output is always about 33% larger, plus a few bytes for the data URI header.

Can I embed a font this way?

Yes, and it eliminates a render-blocking request for a critical font. But fonts are typically 20–100 KB, so inlining bloats your CSS and prevents the font being cached across pages. Preloading is usually better.

Is the MIME type detected reliably?

It comes from the browser, which uses the file extension and content signature. The tool shows it so you can correct it if the data URI needs a different type.