Skip to content
DevTrove

Encoding

Base64 Encode / Decode

Convert text and files to and from Base64 or a data URI.

Runs in your browser

Mode

For encoded files. URL-safe does not apply to a data URI.

How to use

  1. Choose Encode to turn text into Base64, or Decode to turn Base64 back into text.
  2. Paste or type your input. The result updates as you type.
  3. For Encode, enable URL-safe output if the value will be used in a URL, filename or JWT.
  4. To encode a file (up to 3 MiB), clear the input box, then choose Encode a file. Enable Data URI to get a data:<type>;base64,... value you can embed in HTML or CSS.
  5. To save decoded bytes, for example an image, choose Download as file in Decode mode. A pasted data URI keeps its file type.
  6. Use Copy to copy the result to your clipboard.

What is Base64?

Base64 is an encoding that represents binary data using 64 printable ASCII characters (A–Z, a–z, 0–9, + and /). It is commonly used to embed data in JSON, email, data URLs and HTTP headers, where raw bytes are not allowed.

Base64 is an encoding, not encryption. Anyone can decode it, so it must never be used to protect secrets.

Text, files and UTF-8

This tool encodes text as UTF-8 before converting it to Base64, so emoji and non-Latin scripts round-trip correctly. Decoded text is shown only when the bytes are valid UTF-8; binary data such as images can be saved with Download as file.

Files up to 3 MiB are read in your browser and never leave it. The output is plain Base64, or a data URI when Data URI is enabled. A data URI always uses the standard alphabet, so URL-safe output does not apply to it.

Standard vs URL-safe Base64

URL-safe Base64 (often called base64url, defined in RFC 4648 §5) replaces + with - and / with _, and usually omits the trailing = padding. It is used in JWTs and anywhere a value must appear in a URL or filename. The decoder accepts either alphabet, with or without padding.

FAQ

Is my data uploaded?
No. Encoding and decoding run entirely in your browser using built-in JavaScript APIs. Your input and files are not sent to a server and are not stored.
Why does decoding say “not valid UTF-8”?
The Base64 value decodes to bytes that are not UTF-8 text — for example an image or compressed data. Use Download as file to save the bytes. The file is named decoded.png, decoded.pdf and so on when the input is a data URI of a known type, otherwise decoded.bin.