Home › Developer Tools › Base64 Encoder Decoder

Base64 Encoder Decoder

Encode text or files to Base64, decode Base64 back to text or a file, and create data URIs for images. Everything runs in your browser.

0 characters
 
Advertisement

How to use the Base64 Encoder Decoder

  1. Text: type or paste text and press Encode, or paste Base64 and press Decode. With Live on, the result updates as you type.
  2. URL-safe: tick URL-safe to use - and _ instead of + and / and drop the = padding, as used in URLs and JWTs.
  3. Files and images: open the File to Base64 tab and drop a file. Copy the raw Base64, the data URI, or a ready-made HTML or CSS snippet.
  4. Base64 to file: paste Base64 or a data URI in the Base64 to File tab. The file type is detected, images are previewed, and you can download the file.

Base64 examples

InputBase64URL-safe Base64
Hello worldSGVsbG8gd29ybGQ=SGVsbG8gd29ybGQ
Café ☕Q2Fmw6kg4piVQ2Fmw6kg4piV
??>>Pz8+Pg==Pz8-Pg

Text is converted to UTF-8 bytes before encoding, so accents, emoji and non-Latin scripts round-trip correctly. That matches what most programming languages and APIs expect.

What is a data URI?

A data URI puts a whole file inside a link, in the form data:[type];base64,[data]. You can use one as the src of an image or as a CSS background, so small icons load without an extra request. For large images a normal file is usually better, because Base64 makes them about a third bigger and they can't be cached separately.

Frequently asked questions

What is Base64?

Base64 is a way to write any data, including images and files, using only 64 safe text characters (A to Z, a to z, 0 to 9, + and /). It is used to put binary data into JSON, emails, URLs, HTML and CSS.

Is Base64 encryption?

No. Base64 is an encoding, not encryption. Anyone can decode it, so never use it to hide passwords or secrets.

Why is Base64 bigger than the original?

Every 3 bytes of data become 4 Base64 characters, so encoded data is about 33% larger than the original.

What is URL-safe Base64?

URL-safe Base64 (base64url) replaces + with - and / with _, and usually drops the = padding, so the result can be used in URLs, file names and JSON Web Tokens without escaping.

How do I convert an image to Base64?

Open the File to Base64 tab and drop your image. You get the Base64 text plus a data URI such as data:image/png;base64,… that you can paste straight into an img src or a CSS background.

Are my files uploaded?

No. Files are read and encoded locally in your browser and never leave your device.

Related tools