GALAXY OF TOOLS

DEV SECTOR

Base64 Encode / Decode

Encode text or files to Base64 and decode Base64 back to text or a downloadable file — UTF-8 safe.

Runs entirely in your browser. Nothing you enter or upload is sent to a server.

Base64 encode and decode text or files in one place

The Base64 encoder and decoder converts text to Base64 and back, and turns any file into Base64 — or a Base64 string back into the original file. It is the quick way to read an encoded API field, build a data: URI, debug a Basic Auth header or move binary data through a system that only accepts text.

Many quick converters break on anything beyond plain English because the browser’s btoa() only accepts Latin-1. This tool encodes text as UTF-8 first, so accents, Hindi, Chinese, emoji and symbols like ₹ and £ round-trip perfectly. When you decode, it checks whether the result is readable text or binary, recognises over 30 file types from their first bytes, and lets you download the file with the right extension.

Encoding and decoding happen entirely in your browser. Nothing is uploaded, which matters because Base64 often hides credentials, tokens and private documents.

How to use the Base64 Encode / Decode

  1. Choose Encode or Decode at the top.
  2. Type or paste into the input box. With Live update on, the result appears as you type; otherwise press the main button.
  3. To encode a file, press Encode a file or drop the file on the input box. Tick Add data: URI prefix if you want a ready-to-use data: URL.
  4. For tokens and URLs, tick URL-safe. For email or PEM-style output, tick Wrap lines at 76 characters.
  5. When decoding binary data, check the detected file type and press Download file. Otherwise use Copy or Download.

Base64 Encode / Decode features

Proper UTF-8 handling

Text is converted to UTF-8 bytes before encoding and decoded strictly afterwards, so every language and emoji survives the round trip.

Files both ways

Encode any file to Base64 or a data URI, and turn Base64 back into a downloadable file — PDFs, images, ZIPs, fonts and more.

File type detection

Decoded bytes are matched against more than 30 magic-number signatures, such as PNG, JPEG, PDF, ZIP, MP3 and MP4, and images get a live preview.

URL-safe Base64

Switch to the RFC 4648 “base64url” alphabet with - and _ and no padding, as used in JWTs and URLs. Decoding accepts both alphabets automatically.

Clear error messages

Invalid characters are reported with their line and column, and misplaced padding or truncated input is explained in plain English.

Smart auto-detect

Paste Base64 into the encoder by mistake and the tool offers to decode it instead.

How Base64 works

Base64, defined in RFC 4648, represents binary data using 64 safe characters: A–Z, a–z, 0–9, + and /. Every 3 bytes of input (24 bits) are split into four 6-bit groups, and each group becomes one character. When the input length is not a multiple of 3, the output is padded with one or two = signs.

Because 3 bytes become 4 characters, Base64 is always about 33% larger than the original — a 300 KB image becomes roughly 400 KB of text. That is why large images are better served as normal files than as data URIs. For example, the word Man encodes to TWFu, and Ma becomes TWE=.

Base64 variants compared

VariantCharacters 62 and 63PaddingUsed in
Standard (RFC 4648 §4)+ and /YesEmail bodies, data URIs, most APIs
URL-safe (RFC 4648 §5)- and _Usually omittedJWTs, URLs, file names
MIME (RFC 2045)+ and /YesEmail attachments, wrapped at 76 characters
PEM+ and /YesCertificates and keys, wrapped at 64 characters

Base64 is encoding, not encryption

Anyone can decode Base64 in seconds, so it gives no protection at all. HTTP Basic Auth headers, Kubernetes secrets and JWT payloads are all Base64 and are fully readable. To protect data, encrypt it with a real cipher — try Text Encryption — and to check integrity, use the Hash Generator.

Base64 Encode / Decode FAQ

How do I decode a Base64 string?

Choose “Decode”, paste the Base64 text and the decoded text appears instantly. If the data is a file, such as a PDF or image, the type is detected and you can press “Download file” to save it.

Why does my decoded text show strange characters?

The original was probably not UTF-8 text, or it was binary data. When the bytes are not valid text, this Base64 decoder shows a hex preview instead and offers the data as a file download.

How do I convert an image or PDF to Base64?

Press “Encode a file” and choose it. Tick “Add data: URI prefix” to get a string you can paste straight into HTML or CSS. For images specifically, Image to Base64 also generates ready-made img and CSS snippets.

What is URL-safe Base64?

It swaps + for - and / for _, and usually drops the = padding, so the result can sit in a URL or file name without escaping. JSON Web Tokens use it — the JWT Decoder decodes them for you.

Is it safe to paste secrets here?

Yes. The conversion runs in JavaScript on your device and nothing is sent anywhere or saved. Remember that Base64 itself is not secret, so treat encoded credentials as plain text.

Why is the Base64 output bigger than my file?

Base64 needs 4 characters for every 3 bytes, so output is about 33% larger, plus a little more if you wrap lines.

You might also need