Skip to content

Base64 encoder / decoder

Encode Unicode text as Base64 or decode it, with URL-safe options and an interactive byte preview.

0 / 100,000 characters

Base64

Your conversion appears here as you type.
0 output characters
Inspect UTF-8 bytes

0 bytes · each block below is one byte in hexadecimal.

Processed on your device

How it works & useful details

How to use this tool

Choose Encode or Decode, paste text, and inspect the live conversion. Swap reverses the result into the input.

Details and limits

UTF-8 text only. Invalid UTF-8 and noncanonical Base64 padding bits are rejected. Standard Base64 uses + and /; URL-safe uses - and _ and omits padding. Both accept correctly unpadded input and ASCII whitespace.

Up to 100,000 input code units. Live preview pauses above 8,000. Inputs and outputs stay on your device.

About this tool

Base64 encoder / decoder converts Unicode text to Base64 and back, with options for URL-safe output and an interactive byte preview. The byte view helps explain why Base64 length grows and which UTF-8 bytes each character contributes.

Encoding and decoding happen locally in your browser. If the input is not valid Base64, the decoder says so instead of returning silently corrupted text.

How to use it

  1. Choose to encode or decode and paste your input.
  2. Enable the URL-safe variant if the output will appear in a URL or filename.
  3. Inspect the byte preview to see the UTF-8 representation.
  4. Copy or download the result.

Worked examples

Hello, world!  →  SGVsbG8sIHdvcmxkIQ==
café ☕         →  Y2Fmw6kg4piV
>>?            →  Pj4/   (standard)
>>?            →  Pj4_   (URL-safe)

Base64 turns every 3 bytes into 4 characters from a 64-character alphabet, so encoded data is about 33% larger than the original. When the input length is not a multiple of 3, = padding fills the last group. "Hello, world!" is 13 bytes, so it ends with ==. Non-ASCII text is encoded as UTF-8 first: é takes two bytes and ☕ three, which is why "café ☕" becomes 12 characters.

Standard vs. URL-safe Base64

Standard Base64 uses + and /, which have special meanings in URLs and file paths. The URL-safe variant (RFC 4648 §5) replaces them with - and _ and usually drops the padding. JWTs, many web APIs, and data in query strings use URL-safe Base64. MIME email attachments and data: URIs use the standard form. Decoding with the wrong alphabet is the most common cause of "invalid character" errors.

Base64 is an encoding, not encryption. Anyone can decode it, so never treat a Base64 string as hidden or protected. Its purpose is to carry binary data safely through systems that only handle text.

Frequently asked questions

Why is the encoded string longer than the input?

Base64 represents three bytes as four characters, so the output is roughly a third larger, plus padding when the length is not a multiple of three.

What does URL-safe Base64 change?

It replaces the characters + and / with - and _ so the value can be used in URLs and file names without percent encoding.

Is Base64 a form of encryption?

No. It is an encoding that anyone can reverse; use real encryption when confidentiality matters.

Can I decode Base64 that contains line breaks?

Yes. ASCII whitespace, including the line breaks that email and PEM files insert every 64 or 76 characters, is ignored when decoding.