File to Base64

Select a file to encode it as Base64, as a plain string or as a data URI you can paste into HTML, CSS, JSON or an API request. Encoded in your browser.

  • Runs in your browser
  • Free to use
ctrl + enterOutput grows by about a third.

About this tool

Embedding a small image in CSS, sending a file through a JSON API or pasting a certificate into a config: all of them need the file as text. File to Base64 reads any file in your browser and returns the Base64 string or a complete data URI with the right MIME type, wrapped for display and copied intact with one click. Nothing leaves your device.

Decode with Base64 to Image, Base64 to PDF or Base64 Encode/Decode.


How to use it — quick steps

  1. 01

    Add the file

    Drop any file on the dashed area or choose it from your device; a new file replaces the previous one.

  2. 02

    Pick the output

    A plain Base64 string, or a data URI with the MIME type prefix for use in src and url() attributes.

  3. 03

    Press "Convert to Base64"

    The encoded text appears below the file with a [copy] action; it is wrapped on screen and copied intact.


Key features of this tool

  • Base64 or data URI

    Plain Base64 for APIs and JSON, or a ready-made data URI for inline images, fonts and files in HTML and CSS.

  • Encoded on your device

    The file is read with the File API and encoded in memory; nothing is uploaded or stored.

  • One-click copy

    The whole file Base64 string is copied instantly in one click, no matter how long it is.


Frequently asked questions

What is a data URI?

A URL that embeds the file itself: data:image/png;base64,iVBOR… It can replace an external file in an img src, a CSS url() or a link, at the cost of being about 33% larger than the binary.

Why is there a size limit?

Base64 text is held in the page; 10 MB of file becomes about 13 MB of text, beyond which browsers and clipboards struggle.

How do I decode it back?

Use Base64 to Image, Base64 to PDF or Base64 Encode/Decode (depending on the content) to convert the Base64 string to a file.

Are my files or data uploaded?

No. The tool is plain JavaScript that runs in your browser; the files or data you provide here are never uploaded to our servers.


Popular tools


From APIVoid, the team behind IPVoid

Enhance your threat detection capabilities

APIVoid provides threat intelligence APIs to automate security workflows, with simple pricing and a 30-day free trial to start, no card required.

What you get with APIVoid

  • IP reputation and blacklist checks
  • Domain and URL reputation scoring
  • DNS lookups and propagation
  • SSL certificate and TLS details
  • Website screenshots and page info
  • Email address verification
  • 30+ cybersecurity APIs
30-day free trial