Skip to content
codinganthem
All tools/Encoders/Base64 Encoder / Decoder

Base64 Encoder / Decoder

Encode or decode Base64 text and files instantly online. Free Base64 converter for JWTs, data URLs, and auth headers — everything runs in your browser.

20 chars
More
Buy me a coffee

What Base64 is

Base64 turns bytes into text using 64 safe characters: A–Z, a–z, 0–9, + and /. Every 3 bytes become 4 characters, so encoded data is about a third larger than the original. When the input length isn't a multiple of 3, one or two = signs pad the end.

It exists so binary data can travel through systems that only handle text, such as JSON, email, HTML attributes and HTTP headers.

Examples

Hello        ->  SGVsbG8=
Hi           ->  SGk=
user:secret  ->  dXNlcjpzZWNyZXQ=

This tool encodes text as UTF-8 first, so accented letters, emoji and non-Latin scripts round-trip correctly.

Standard vs URL-safe Base64

+ and / have special meanings in URLs, so URL-safe Base64 (often called base64url) replaces them with - and _, and usually drops the = padding. JWTs use base64url for all three parts. Turn on URL-safe in the tool when the string is going into a URL, a file name or a token, or when you're decoding one of those.

Base64 is not encryption

Anyone can decode Base64; it hides nothing. HTTP Basic auth, for example, sends Authorization: Basic dXNlcjpzZWNyZXQ=, which is just user:secret encoded, so it must only be used over HTTPS. If you need to protect data, encrypt it, and for passwords use a slow hash like bcrypt (Bcrypt Generator).

Data URLs

A data URL embeds a file directly in HTML or CSS: data:image/png;base64, followed by the encoded bytes. It saves a network request for small icons but makes the page larger and can't be cached separately. To make one from an image, use Image to Base64.

Frequently asked questions

Why does Base64 end with = or ==?+

Base64 encodes 3 bytes as 4 characters. When the input isn't a multiple of 3 bytes, = signs pad the output to a multiple of 4 characters: one = for 2 leftover bytes, two for 1 leftover byte.

Is Base64 encryption?+

No. Base64 is a reversible encoding with no key, so anyone can decode it. Use encryption to protect data and a password hash such as bcrypt for passwords.

What's the difference between Base64 and base64url?+

base64url replaces + with - and / with _, and usually drops the = padding, so the result is safe in URLs and file names. JWTs use base64url.

Why is my Base64 output bigger than the input?+

Base64 turns every 3 bytes into 4 characters, so the output is about 33% larger, plus up to two padding characters.

Why won't my Base64 decode?+

Common causes are a copy that lost characters or padding, URL-safe input decoded without the URL-safe option (or the other way round), or Base64 of binary data such as an image, which isn't readable text.