Filery

Base64 Encode / Decode

Encode and decode Base64 for text, files and data URIs.

Choose file or drop it anywhere on this page Processed on your device — never uploaded

How to base64 encode / decode

  1. Type or paste text, or switch to file mode and drop a binary file.
  2. Choose encode or decode.
  3. Copy the result, or toggle data-URI format for embedding.

About this tool

Base64 is everywhere in web development precisely because binary data and text-based protocols are an uncomfortable mix. JSON has no binary type, so a certificate, an image embedded in a response, or a serialised object ends up as a Base64 string. Email attachments are encoded as MIME multipart, which is Base64 with line breaks. JWTs carry their payload as Base64URL. Understanding the format takes five minutes; having a tool to convert it quickly is useful for the rest of your career.

The data URI mode is the conversion most relevant to front-end work: it produces the exact string you can drop into an src attribute or a CSS background-image, allowing you to inline small assets without a separate file request. The rule of thumb is to use this for assets under 4–8 KB; above that size, a separate file request with HTTP caching is faster on subsequent loads.

Questions

What is Base64 used for?
Base64 encodes arbitrary binary data as printable ASCII characters, which makes it safe to include in contexts that only accept text: JSON values, HTML attributes, CSS, XML documents, and email attachments (MIME). The cost is size — Base64 output is about 33% larger than the original binary.
What is a data URI and when should I use one?
A data URI embeds the file content directly into an HTML or CSS attribute: <img src="data:image/png;base64,iVBOR…">. This eliminates a network request, which is useful for small icons, loading spinners and logos. It is a bad idea for large images because it bypasses browser caching — the same data is re-parsed every time the HTML loads.
What is the URL-safe variant?
Standard Base64 uses + and / as the 62nd and 63rd characters. Both have special meaning in URLs and query strings, so Base64URL replaces them with - and _ respectively. If the encoded value is going into a URL parameter, a JWT, or a filename, use the URL-safe variant.
Can I encode a sensitive file here safely?
Yes. Encoding and decoding runs entirely in your browser — no data is transmitted. This includes binary files, configuration files with credentials, or anything else you would rather not send to a server.