Base64 Encode and Decode

Free online Base64 encoder and decoder. Convert text to Base64 and back instantly — fast, secure, and processed entirely in your browser.

Encode to Base64 format

Decode from Base64 format

Hint: remove spaces/newlines and ensure the value uses valid Base64 characters with correct padding.

Reference

Base64 fundamentals

Use this as a quick mental model while encoding or decoding text in the forms above.

01
What Base64 does

Base64 transforms raw bytes into a restricted set of text characters, which makes binary content easier to move through systems built for plain text.

02
Where it is used

You will often see Base64 in API payloads, email attachments, tokens, embedded assets, and other places where binary data must be represented safely as text.

03
What decoding restores

Decoding reconstructs the original byte sequence. That only works when the input is valid Base64 and any required padding characters are still present.

04
What it does not do

Base64 is not encryption. It improves transport compatibility, but anyone can reverse it, so it should never be treated as a security layer.

Quick example

From readable text to Base64 and back

The value Hello becomes SGVsbG8= when encoded. Decoding SGVsbG8= returns the original textHello.

Plain textHello
EncodedSGVsbG8=
Decoded resultHello

Padding with = helps keep the encoded output aligned. Some systems omit it, but many decoders still expect properly padded input.

Detailed view: encoding process and related formats
  • How Base64 works: input is first treated as bytes (commonly UTF-8 bytes for text), then processed in 24-bit blocks (3 bytes). Each block is split into four 6-bit values, and each value maps to one Base64 character.
  • Base64 alphabet: it uses 64 symbols: A-Z , a-z, 0-9, + , and /. Padding uses = when needed.
  • Size impact: Base64 is transport-friendly, but output is typically about 33% larger than the original binary data.
  • ASCII context: standard ASCII is a 7-bit set (values 0-127). Base64 outputs printable ASCII characters so the result can safely move through text-only systems and protocols.
  • Common modes/variants: standard Base64 uses+ and /, while Base64URL replaces them with - and _ for URL/file safety. MIME-style Base64 can include line wrapping.
  • Whitespace behavior: some decoders ignore spaces and newlines, while strict decoders reject them. Trimming or normalizing whitespace before decode helps avoid errors.
  • Padding behavior: one or two= characters may appear at the end. Some systems omit padding, but many libraries expect valid padding in strict mode.
  • Related encodings: Hex is easy to read but larger (2 chars per byte), Base32 is case-friendly but even bigger, URL encoding escapes reserved URL characters, and UTF-8/UTF-16 define how text maps to bytes rather than binary to text transport.
  • Security reminder: Base64 is not encryption or hashing. It only changes representation, so sensitive data still needs encryption in transit and at rest.
History and modern applications
  • Where it came from: Base64 grew out of early internet messaging standards where binary data had to pass through systems designed for plain text only.
  • Early standardization: it became widely known through MIME (Multipurpose Internet Mail Extensions) in the early 1990s, especially RFC 1521 (1993), and later formalized in RFC 2045 and RFC 4648.
  • Why it was needed: legacy mail gateways and transport layers often corrupted or rejected raw binary bytes, so a text-safe encoding was required for attachments and rich content.
  • Email adoption: one of the first major uses was encoding email attachments (images, documents, audio) so they could travel reliably across heterogeneous mail systems.
  • Web/API usage today: Base64 is common in JSON payloads, data URLs, and API responses when small binary blobs must be embedded directly in text formats.
  • Security/token ecosystems: Base64URL is used in JWT segments and OAuth/OpenID flows because URL-safe characters avoid escaping issues in web transport.
  • Cloud and integration pipelines: message queues, serverless event payloads, and config files often serialize binary fields as Base64 for interoperability across languages and services.
  • Current best practice: use Base64 for binary to text transport, but prefer raw binary protocols when possible for efficiency, since Base64 adds overhead in size and processing.

FAQ

Frequently asked questions

What is Base64 encoding?

Base64 is a way to represent binary data using a set of 64 printable ASCII characters. It lets binary content travel safely through systems built for text, such as email, JSON and URLs.

Is Base64 the same as encryption?

No. Base64 is an encoding, not encryption. Anyone can decode it back to the original data, so it should never be used to protect passwords or other sensitive information.

Is this Base64 encoder and decoder free and private?

Yes. The tool is completely free and runs entirely in your browser. Your text is never uploaded to a server, so everything you encode or decode stays on your device.

How do I decode a Base64 string?

Paste your Base64 text into the Decode box and press Decode. The value should only contain valid Base64 characters (A-Z, a-z, 0-9, + and /) with any padding using = at the end.

Why does Base64 make data larger?

Base64 encodes every 3 bytes of input into 4 characters, so the output is roughly 33% larger than the original data. That overhead is the trade-off for safe text transport.