🔐 Base64 Encoder / Decoder

Encode text to Base64 or decode Base64 back to plain text. Supports URL-safe mode, UTF-8, and custom line-break lengths.

QUICK LOAD:
PLAIN TEXT INPUT
BASE64 OUTPUT
🔐

Encoded Base64 appears here

Paste input on the left · 100% private · No server calls

About Base64 Encoder / Decoder

Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). Every 3 bytes of input become 4 Base64 characters, so the output is roughly 33% larger than the original. It is the standard encoding used for embedding images in HTML and CSS via data URIs, attaching files in MIME email, encoding credentials in HTTP Basic Auth headers, and representing binary payloads in JSON APIs.

This tool supports standard Base64 (RFC 4648) and URL-safe Base64 (RFC 4648 §5), which replaces+ with - and / with _ to produce output safe for use in URLs and filenames. All conversion runs entirely in your browser — no data is ever sent to a server.

How to encode or decode Base64

  1. Select Encode or Decode mode from the toggle at the top.
  2. Paste your text or Base64 string into the input area.
  3. The result appears instantly in the output area (Auto Convert is on by default).
  4. Enable URL-safe mode if the output will be used in a URL, filename, or JWT token.
  5. Set a Line Break length (64 or 76) when producing PEM certificates or MIME parts that require fixed-width lines.
  6. Use the ⇄ Swap button to flip input and output and switch mode — handy for round-trip verification.
  7. Click Copy to copy the result to your clipboard.

Features

🔒 Encode

Converts plain text or binary data into a Base64 string. UTF-8 characters including emoji and CJK are fully supported.

🔓 Decode

Converts a Base64 string back to its original text. Automatically validates the input and handles missing or extra padding.

🌐 URL-Safe

Replaces + with - and / with _ and strips = padding. Safe for URLs, filenames, JWT tokens, and query parameters.

📏 Line Break

PEM certificates use 64-char lines; MIME email uses 76-char lines. Choose the wrap length that matches your target format.

⇄ Swap

Instantly flip input and output and switch mode — great for quickly validating a round-trip encode/decode.

⚡ Auto Convert

Converts as you type with a short debounce. Disable it for very large payloads and click Convert manually instead.

Frequently Asked Questions

Is Base64 encoding the same as encryption?

No. Base64 is an encoding scheme, not an encryption or hashing algorithm. It converts binary data to a text-safe representation — anyone who sees the Base64 string can decode it instantly with no key. Never use Base64 alone to protect sensitive data. Use proper encryption (AES, RSA) when security is required.

Why does my decoded output look like gibberish?

The original data was likely binary (an image, PDF, or archive), not plain text. Base64 is commonly used to embed binary files inside text formats like JSON or XML. Decoding such a string with a text decoder will produce garbled output because the bytes do not represent valid text characters.

What is the difference between standard and URL-safe Base64?

Standard Base64 uses + and / as its 62nd and 63rd characters, and = for padding. These have special meaning in URLs, so URL-safe Base64 (RFC 4648 §5) replaces + with - and / with _, and omits = padding. JWT tokens, OAuth 2.0 codes, and many modern web APIs use URL-safe Base64.

Why is Base64 output longer than the input?

Base64 encodes every 3 bytes as 4 characters — a 4:3 ratio — meaning output is about 33% larger than the input. Padding characters (=) round the output length up to a multiple of 4. This overhead is the inherent cost of representing binary data using only printable ASCII characters.

What line break length should I use for PEM certificates?

PEM format (used for TLS certificates, SSH keys, and X.509 certificates) requires lines of exactly 64 characters. MIME email attachments use 76 characters per line (RFC 2045). For JSON APIs, data URIs, and JWTs no line breaks are needed.

Base64 encoding and decoding: a practical developer reference

Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It was originally designed to safely transport binary content — like images or certificates — over channels that only support plain text, such as email bodies and HTTP headers.

In modern web development, Base64 appears in many everyday situations: JWT tokens encode their header and payload segments in Base64, HTTP Basic Authentication encodes credentials as Base64 before putting them in the Authorization header, data URLs embed images directly in HTML and CSS, and TLS certificates are distributed in PEM format which is Base64-encoded DER data.

Braxik's Base64 tool handles both standard Base64 (using + and /) and URL-safe Base64 (using - and _ in place of + and /). URL-safe Base64 is used in JWTs and most modern web token formats because + and / need percent-encoding in URLs. Knowing which variant you have prevents the most common decode errors.

The tool supports UTF-8 text encoding, which means it correctly handles accented characters, CJK characters, and emoji alongside standard ASCII. Specifying the wrong character encoding is a common source of corruption when decoding Base64 that contains non-ASCII content.

How it works

Base64 encoding works by splitting the input bytes into groups of three (24 bits). Each 24-bit group is then split into four 6-bit values. Each 6-bit value (0–63) is mapped to a character in the Base64 alphabet. If the input length is not divisible by three, the last group is padded with zero bits and = padding characters are added to the output to indicate how many padding bytes were used.

Decoding reverses this process: each Base64 character is converted back to its 6-bit value, the 6-bit values are concatenated, then split into bytes. The = padding at the end indicates how many bytes of padding to strip. URL-safe Base64 uses the same algorithm but replaces + with - and / with _ so the encoded output can be included in URLs and cookie values without percent-encoding.

UTF-8 text encoding converts multi-byte characters into their byte sequences before encoding, and converts byte sequences back to Unicode characters after decoding. This is why you must know the original character encoding of the data before decoding — decoding UTF-8-encoded Base64 as ISO-8859-1 will produce garbled characters for any non-ASCII input.

Common uses

  • Decode a JWT token segment to inspect claims without using a separate JWT decoder.
  • Decode an HTTP Basic Authentication header value to check the username and password format.
  • Encode short text for test headers, sample payloads, or local curl scripts.
  • Convert between standard and URL-safe Base64 when working with web tokens or cookie values.
  • Decode a PEM certificate or public key to inspect its raw content.
  • Encode a small image or icon as a Base64 data URL for embedding in HTML or CSS without an extra network request.
  • Decode Base64-encoded configuration values from environment variables, Kubernetes secrets, or AWS Secrets Manager.

Before you rely on the result

  • Base64 is encoding, not encryption. Anyone who can see the Base64 string can decode it instantly. Never use it to protect sensitive data in transit or at rest.
  • Check for missing = padding characters when decoding strings copied from URLs or URLs-safe contexts — some implementations omit padding.
  • Confirm whether your Base64 string uses standard (+, /) or URL-safe (-, _) characters before decoding, and select the correct mode.
  • Avoid pasting production secrets, passwords, private keys, or personally identifiable information into any browser-based tool unless you are fully certain it does not phone home.
  • If your decoded output is garbled, check the character encoding — the content may have been encoded with a different encoding than the decoder is using.
  • Line breaks in PEM-encoded Base64 (every 64 characters) should be removed before decoding binary content from certificates.
  • Remember that Base64-encoded data is about 33% larger than the original binary data because every 3 input bytes become 4 output characters.