usefmtly

Base64 Encoder / Decoder

Base64 Encode / Decode — Free online Base64 encoder and decoder. Encode any text or Unicode string to Base64, or decode Base64 back to readable text. Supports standard and URL-safe variants.

0Input bytes
0Output length
EncodeMode
StdVariant
Plain text
Base64

How to encode and decode Base64

  1. Choose Encode or Decode in the toolbar. Encode converts plain text to Base64; Decode converts Base64 back to readable text.
  2. Paste your input. The result appears instantly — no button press required.
  3. Choose Standard or URL-safe depending on your use case. URL-safe replaces + with - and / with _, and removes trailing padding — safe to use in URLs without percent-encoding.
  4. Use Swap to immediately decode what you just encoded, or re-encode decoded output.

Where Base64 is used

Email attachments (MIME)

Email protocols are text-only. Attachments and images are Base64-encoded before being embedded in message bodies.

Data URIs in HTML/CSS

Small images, fonts, or icons can be embedded directly in HTML or CSS as Base64 data URIs to avoid extra HTTP requests.

JSON APIs

APIs that need to pass binary data (images, files, cryptographic keys) through JSON fields use Base64 since JSON is text-only.

JWT tokens

JSON Web Tokens use URL-safe Base64 to encode the header, payload, and signature into a compact, URL-transmittable string.

Basic HTTP authentication

The HTTP Authorization header encodes credentials as Base64: username:password → dXNlcm5hbWU6cGFzc3dvcmQ=

Environment variables and secrets

Binary keys, certificates, and config blobs are often Base64-encoded for safe storage in environment variables or CI/CD secrets.

Standard vs URL-safe Base64

PropertyStandard (RFC 4648 §4)URL-safe (RFC 4648 §5)
Characters 62–63+ and /- and _
Padding= (always)Stripped
URL-safeNo (must percent-encode)Yes
Use caseEmail, files, generalURLs, JWT, filenames

Related tools: URL Encode / Decode for percent-encoding URLs, ROT13 Encoder for simple cipher encoding, or Morse Code Translator for a completely different encoding format.

Learn more about Base64

Want a deeper explanation of how base64 works — the 6-bit groups, the = padding, and why it's not encryption? What Is Base64 Encoding? walks through the algorithm step by step with examples.

Frequently Asked Questions

What is Base64?

Base64 is an encoding scheme that converts binary data into a sequence of printable ASCII characters using 64 symbols: A to Z, a to z, 0 to 9, plus + and /. It is useful when you need to move binary through text-only systems such as email MIME payloads, JSON APIs, HTML data URIs, or config fields that cannot store raw bytes safely. It is encoding, not compression or encryption.

How do I decode Base64?

Switch to Decode mode, paste the Base64 string, and the tool converts it back to readable text instantly. It accepts both standard Base64, which uses + and /, and URL-safe Base64, which uses - and _. If the input is missing padding, the decoder normalizes it automatically so you do not have to clean it up by hand before pasting.

What is URL-safe Base64?

URL-safe Base64 is the RFC 4648 variant that replaces + with - and / with _, then usually removes trailing = padding. That makes the output safer to place in URLs, filenames, query strings, and JWT segments without extra percent-encoding. It is the right choice when the encoded text has to survive routing, copy-paste, or other systems that treat + and / as special characters.

Does Base64 work with Unicode and emoji?

Yes. The tool first converts text to UTF-8 bytes, and then Base64 encodes those bytes, so Unicode characters round-trip correctly. That includes accented letters, CJK characters, emoji, and mixed-language text. If the input is valid Unicode text, the encoded output will decode back to the same characters as long as the Base64 string itself is not altered.

Is Base64 encryption?

No. Base64 is encoding, not encryption, and anyone can reverse it immediately because there is no key, password, or secret involved. It does not hide data, protect privacy, or add security. Use it only when you need to represent binary as text for transport or storage, and keep sensitive data protected with real encryption instead.

Related Tools