Base64 string encoder/decoder

What is a Base64 String Converter?

Base64 encodes bytes as text using 64 safe characters: A to Z, a to z, 0 to 9, + and /, with = for padding. It is used wherever binary or special characters must pass through systems that only handle plain text: HTTP Basic authentication headers, JSON Web Tokens, email attachments, Kubernetes secrets and configuration files.

How to use it

  1. Type or paste text into the encoder to get its Base64 form.
  2. Paste Base64 into the decoder to get the original text back.
  3. Enable URL-safe mode when the value will appear in a URL or a JWT.

How it works

Text is first converted to UTF-8 bytes. Every 3 bytes (24 bits) are split into four 6-bit values, and each value selects one of the 64 characters. If the input length is not a multiple of 3, one or two = characters pad the output.

Example

Man is the bytes 77 97 110, bits 010011 010110 000101 101110, which are 19, 22, 5 and 46, or TWFu. The text héllo encodes to aMOpbGxv, because é takes two bytes in UTF-8.

URL-safe Base64

Standard Base64 uses + and /, which have special meaning in URLs. The URL-safe variant from RFC 4648 replaces them with - and _ and usually drops the padding. JWTs always use this variant.

Important

Base64 is not encryption. Kubernetes secrets and Basic auth headers are only encoded, so anyone who sees them can decode them instantly.

Frequently Asked Questions

Is Base64 encryption?

No. It is a reversible encoding with no key. Anyone can decode a Base64 string, so never rely on it to protect secrets.

Why does my decoded text show strange characters?

The original text was probably encoded with a different character set, or the input is binary data rather than text. This tool decodes as UTF-8.

What are the = signs at the end?

They are padding added when the input length is not a multiple of 3 bytes. One = means 2 bytes in the last group, two mean 1 byte.

What is URL-safe Base64?

A variant that uses minus and underscore instead of plus and slash, so the value can be placed in URLs and file names. JWTs use it.