DevDash

Base64 Encoder & Decoder

Encode text to Base64 or decode Base64 strings. Fully supports UTF-8 characters.

Paste text and click Encode to convert to Base64, or paste a Base64 string and click Decode to reveal the original.

About Base64 Encoding

Base64 is a binary-to-text encoding scheme that converts arbitrary bytes into a safe set of 64 ASCII characters (A-Z, a-z, 0-9, +, and /), plus = for padding. It exists because many transport layers — email (SMTP), JSON, XML, and URLs — were designed for text and can corrupt or reject raw binary data. Base64 gives you a reliable way to embed binary content in these text-only channels.

How Base64 Works

The encoding process takes 3 bytes of input (24 bits) and splits them into 4 groups of 6 bits. Each 6-bit group maps to one of the 64 characters in the Base64 alphabet. If the input length isn't a multiple of 3, the output is padded with one or two = characters. This 3-to-4 ratio is why Base64 always increases data size by approximately 33% — an important consideration when deciding whether to encode large files.

Common Use Cases

You'll encounter Base64 in several everyday development scenarios. Data URIs let you embed small images directly in HTML or CSS (data:image/png;base64,...), eliminating an extra HTTP request. HTTP Basic Authentication headers encode username:password as Base64. Email attachments use Base64 encoding under the hood via MIME. And when you need to pass binary data through a JSON API that only supports strings, Base64 is the standard approach.

Base64 Is NOT Encryption

This is a critical distinction that catches beginners off guard. Base64 is a reversible encoding — anyone can decode it instantly without any key or password. Never use Base64 to "hide" sensitive data like passwords, tokens, or API keys. If you need confidentiality, use proper encryption (AES, for example) and then Base64-encode the encrypted output if you need it in text form.

URL-Safe Base64

Standard Base64 uses + and / characters, which have special meaning in URLs and can cause issues in query parameters. URL-safe Base64 replaces + with - and / with _, and often omits the trailing = padding. This variant is used in JWTs, which you can inspect with the JWT Decoder. When decoding Base64 that looks like it came from a URL or a JWT, check whether it uses the standard or URL-safe alphabet — mixing them up will produce garbage output.

Frequently Asked Questions

What is Base64 encoding used for?

Base64 encoding is used to embed binary data in text-based formats. Common use cases include data URIs for inline images in HTML/CSS, HTTP Basic Authentication headers, email attachments via MIME, and embedding binary content in JSON payloads that only support string values.

Is Base64 encoding the same as encryption?

No, Base64 is a reversible encoding scheme, not encryption. Anyone can decode a Base64 string instantly without any key or password. It provides no confidentiality or security. If you need to protect sensitive data, use proper encryption like AES and then Base64-encode the encrypted output if a text format is required.

Why does Base64 make files larger?

Base64 converts every 3 bytes of input into 4 ASCII characters, resulting in approximately a 33% increase in size. This overhead is the tradeoff for being able to represent binary data using only safe text characters. For large files, this size increase can be significant, so Base64 is best suited for small assets.

What is URL-safe Base64?

URL-safe Base64 replaces the standard + character with - and / with _ so the encoded string can be safely used in URLs and query parameters without additional percent-encoding. It also often omits trailing = padding. This variant is used in JWTs and many web APIs.

How do I decode a Base64 string?

Paste the Base64 string into a decoder tool like this one and click Decode. Programmatically, use atob() in JavaScript, base64.b64decode() in Python, or Base64.getDecoder() in Java. For URL-safe Base64, replace - with + and _ with / before decoding with standard libraries.