Base64 Encode and Decode

Base64 encode and decode: paste your text, choose direction and format, copy the result. This tool converts text to Base64 or Base64url and back – accented letters and emoji handled correctly as UTF-8 – and does URL encoding with percent signs in all three common variants. Invalid input is reported with its position.

Source: RFC 4648, RFC 4648 – The Base16, Base32, and Base64 Data Encodings (§ 4 Base64, § 5 Base64url, § 3.2 Padding). Updated: .

My Toolbox

To decode, paste the Base64 or percent-encoded text. Line breaks in Base64 are ignored.

Your text stays in your browser – it is not sent, not stored and not added to the address bar.

Result

Result
R3JlZXRpbmdzIGZyb20gWsO8cmljaCEg8J+Riw==
Size
24 characters = 28 bytes UTF-8 → 40 characters

How it is calculated

Base64 represents arbitrary bytes using just 64 printable characters (A–Z, a–z, 0–9, + and /). Every 3 bytes become 4 characters; if bytes are left over at the end, one or two equals signs fill the gap (padding). The result is about a third longer than the original. This lets binary data travel through channels that only accept text – email attachments, data URLs (data:image/png;base64,…), HTTP Basic Auth or JSON.

How to encode and decode Base64

  1. Paste your text or Base64 string into the input field.
  2. Choose the direction (encode or decode) and the format: Base64, Base64url or one of the three URL encodings.
  3. Tick or untick “Add padding (=)” as needed and copy the result.

Base64 is not encryption. Anyone can turn it back into the original without a key. Never rely on Base64 to protect credentials.

Base64 vs. Base64url

The plus sign and the slash have special meanings in URLs and file names. Base64url (RFC 4648 § 5) therefore replaces them with the minus sign and the underscore and usually drops the padding – JSON Web Tokens (JWT) are encoded this way. Example: the bytes FB FF become +/8= in Base64 and -_8 in Base64url.

Why UTF-8 matters

Base64 encodes bytes, not letters. The tool therefore converts your text to UTF-8 first: “ü” becomes two bytes, an emoji four. The browser’s built-in btoa() can’t do this and throws an error on non-Latin-1 characters. If the decoded bytes aren’t valid UTF-8 text, the tool shows them as hexadecimal values.

URL encoding: three variants

Every character outside the allowed set is written as % followed by two hex digits per UTF-8 byte (RFC 3986 § 2.1): space = %20, é = %C3%A9.

All conversions run in your browser. Your input is not sent, not stored and not written into the address bar.

More developer tools: calculate checksums with the SHA-256 and MD5 hash generator, check JSON with the JSON formatter and validator and create unique IDs with the UUID generator.

Frequently asked questions

How do I decode Base64?

Choose “Decode” and the “Base64” format, then paste the code – the plain text appears straight away. If the code contains - and _, it is Base64url; choose that format instead.

Is Base64 encryption?

No. Base64 is just another way of writing the same data and can be reversed without a key. To protect data you need real encryption, and for passwords a password hash.

Why does Base64 often end with = or ==?

Base64 works in groups of 3 bytes. If 1 or 2 bytes are left at the end, the output is padded with == or = so that its length is a multiple of 4. Base64url usually omits this padding.

What is the difference between encodeURI and encodeURIComponent?

encodeURI is meant for complete addresses and leaves / ? & = # alone. encodeURIComponent encodes those too and is the right choice for individual parameter values – otherwise an & inside the value would break the URL apart.

Why is a space sometimes %20 and sometimes +?

In paths and under RFC 3986 a space is written as %20. HTML forms (application/x-www-form-urlencoded) write it as +. When decoding you need to know which variant you have – a real plus sign is written as %2B there.

How much bigger does a file get in Base64?

About 4/3 of the original size: 3 bytes become 4 characters. A 300 KB image becomes roughly 400 KB in Base64, a little more with MIME line breaks.

Sources and legal basis

As of: · Editorial policy

Related tools