Skip to content
FestivKit

Base64 Encoder / Decoder

Convert text to Base64 and back with UTF-8 support. Invalid Base64 is reported instead of producing garbage.

Your data stays in your browser. This tool processes your input locally and does not upload it to a server.

What is Base64 encoding?

Base64 is a way to represent binary data using only 64 printable ASCII characters, defined in RFC 4648. Every 3 bytes become 4 characters, so output is about one third larger. It lets bytes travel through text-only channels such as JSON, email and URLs. It is an encoding, not encryption.

How this tool encodes and decodes

Encoding first converts your text to UTF-8 bytes, then encodes those bytes as Base64. This is why accented letters and emoji round-trip correctly, unlike a plain btoa call, which fails on characters outside Latin-1.

Decoding accepts standard Base64 and the URL-safe variant, which uses - and _ instead of + and /. Whitespace and line breaks are ignored. Invalid input shows an error instead of garbled text. If the decoded bytes are not valid UTF-8, the tool still shows the result with replacement characters and a warning.

Common uses

You meet Base64 in data URIs, HTTP Basic authentication headers, email attachments (MIME), JWT segments, and binary fields inside JSON or XML. Developers decode it to inspect a value and encode it to embed small payloads.

Everything is processed locally in your browser, so tokens or sample data you paste are not uploaded. This tool works on text; it does not read files.

Examples

Encode ASCII text

Input

Hello, FestivKit!

Output

SGVsbG8sIEZlc3RpdktpdCE=

The trailing = is padding because the input length is not a multiple of 3.

Encode Unicode text

Input

héllo 🎁

Output

aMOpbGxvIPCfjoE=

Characters are encoded as UTF-8 bytes first.

Decode

Input

SGVsbG8sIEZlc3RpdktpdCE=

Output

Hello, FestivKit!

Common mistakes and edge cases

  • Base64 is not encryption. Anyone can decode it. Never use it to hide passwords or secrets.
  • Output is roughly 33% larger than the input. Embedding big files as Base64 bloats pages.
  • Standard and URL-safe alphabets differ. Use the URL-safe form in URLs and filenames, since + and / have special meaning there. This decoder accepts both; the encoder writes the standard alphabet.
  • Padding (=) must be at most two characters at the end. The decoder rejects other stray characters, such as a "data:" prefix.
  • Decoding binary data such as an image as text gives unreadable characters. The tool warns when bytes are not valid UTF-8.
  • Encoding the same text with a different character encoding, such as UTF-16, gives different Base64. This tool always uses UTF-8.

How to use this tool

  1. Paste text or a Base64 string.
  2. Encode or decode.
  3. Swap the panes if you want to run the result through the other action.

Frequently asked questions

Is Base64 encryption?

No. Base64 is a reversible encoding with no key, so anyone can decode it instantly. It exists to make binary data safe for text-only systems, not to protect it. If you need confidentiality, use real encryption such as AES, and use a password hashing function for passwords. Treat Base64 text exactly as you would treat the plain data.

Why does Base64 output end with = signs?

Base64 works on groups of 3 bytes that become 4 characters. If the input length is not a multiple of 3, the last group is padded with one or two = characters so the output length is a multiple of 4. One = means the last group held 2 bytes, and == means it held 1 byte.

How does this tool handle Unicode and emoji?

It converts text to UTF-8 bytes before encoding and decodes the bytes back to text, so accents, non-Latin scripts and emoji survive a round trip. The browser function btoa alone throws an error on such characters. Encoding the same text in a different charset will produce different Base64.

What is URL-safe Base64?

It is the variant in RFC 4648 section 5 that replaces + with - and / with _, so the string can sit in a URL or filename without percent-encoding. JWTs use it, usually without padding. This decoder accepts both alphabets automatically. The encoder produces the standard alphabet.

Why do I get "not valid Base64"?

The input contains characters outside A-Z, a-z, 0-9, +, /, - and _, or the = padding is misplaced. Check for stray quotes, a "data:" prefix, or extra text around the string. Spaces and line breaks are fine, since they are removed before decoding.

References

Last reviewed

Related tools

Browse all tools