Base64 Encoder/Decoder

Data Stays on Your Device

Encode text to Base64 or decode Base64 strings back to text

Input Text
Loading...
Base64 Encoded
Loading...

About Base64 Encoding

Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It's commonly used to encode data for transmission over media designed to deal with text.

What is the Base64 Encoder and Decoder?

This tool converts text to Base64 and decodes Base64 back to text. Base64 represents arbitrary bytes using only 64 printable ASCII characters, which lets binary data travel safely through channels that were designed for text.

Base64 works by reading the input three bytes at a time, 24 bits, and re-splitting those bits into four six-bit groups. Each six-bit group indexes into an alphabet of A-Z, a-z, 0-9, plus, and slash. When the input length is not a multiple of three, the output is padded with one or two equals signs.

That expansion is the tradeoff: Base64 output is roughly 33% larger than the input. In exchange, the result survives transmission through systems that would mangle raw bytes, such as email bodies, JSON string fields, and URLs.

It is important to be clear that Base64 is an encoding, not encryption. It provides no confidentiality whatsoever, anyone can decode it trivially, as this page demonstrates. Never use it to protect a secret.

How to use the Base64 Encoder and Decoder

  1. Enter your input. Type or paste text into the input pane. For decoding, paste the Base64 string instead.
  2. Click Encode to Base64. The encoded string appears in the output pane, ready to copy.
  3. Click Decode from Base64 to reverse it. Pasting an encoded string and decoding returns the original text. Malformed input is reported as an error.
  4. Copy or download the result. Long encoded strings are easier to move via the download button than by selecting them manually.

Worked examples

Encoding a simple string

Eleven input bytes become sixteen output characters, including one padding character, illustrating the size increase.

Input
Hello World
Output
SGVsbG8gV29ybGQ=

Decoding a Basic Auth credential

HTTP Basic authentication transmits credentials as Base64-encoded username:password. This is exactly why Basic Auth without TLS is unsafe, the credential is readable by anyone who can see the request.

Input
ZGVtbzpzM2NyZXQ=
Output
demo:s3cret

The encoding offers no protection. Only the surrounding TLS connection does.

Understanding padding

The number of trailing equals signs depends on the input length modulo three.

Input
A     -> QQ==
AB    -> QUI=
ABC   -> QUJD
Output
One leftover byte produces two padding characters,
two leftover bytes produce one, and an exact
multiple of three produces none.

Common use cases

  • Embedding images in CSS or HTML. A data URI carries a small image inline as Base64, removing a network round trip at the cost of a larger stylesheet or document.
  • Inspecting JWTs. The header and payload segments of a JSON Web Token are Base64url-encoded JSON, so decoding them reveals the claims.
  • Putting binary data in JSON. JSON has no binary type, so file contents are commonly carried as a Base64 string field.
  • Email attachments. MIME uses Base64 to send attachments over SMTP, a protocol that historically assumed 7-bit text.
  • Debugging encoded configuration. Kubernetes Secrets store values as Base64, so decoding is often the first step in checking what a secret actually contains.

Features and limitations

  • Encodes and decodes in both directions from the same interface.
  • Handles Unicode correctly by encoding text as UTF-8 before Base64 encoding it, so non-ASCII characters round-trip intact.
  • Reports malformed input rather than producing silently corrupted output.
  • Standard Base64 alphabet. Base64url substitutes minus and underscore for plus and slash, so it differs, so JWT segments may need adjusting before decoding.
  • Very large inputs are limited by browser memory, since the whole string is held at once.

Frequently asked questions

Is Base64 encryption?

No, and this is the single most important thing to understand about it. Base64 is a reversible encoding with no key and no secret. It offers zero confidentiality. Use TLS for data in transit and real encryption for data at rest.

Why is my encoded output larger than the input?

Base64 represents every three bytes as four characters, so output is about 133% of the input size, plus padding. That overhead is the cost of restricting the output to a safe printable alphabet.

What are the equals signs at the end?

They are padding. Base64 works in three-byte groups, so when the input length is not divisible by three, one or two equals signs are appended to complete the final group.

Does it handle emoji and non-English text?

Yes. The input is converted to UTF-8 bytes before encoding, so emoji, accented characters, and non-Latin scripts encode and decode correctly.

Why does my JWT segment fail to decode?

JWTs use Base64url, a variant that replaces plus with minus and slash with underscore, and usually omits padding. Convert those characters back and add padding, or use the dedicated JWT Decoder.

Is my data sent to a server?

No. Encoding and decoding happen in your browser, which is why it is safe to decode a Kubernetes secret or an auth header here.

All processing happens locally in your browser, your data never leaves your device.