U
UseCalcForge Free Online Calculators
Developer Tools

Base64 Encoder & Decoder.

Encode text to Base64 or decode a Base64 string back to text. Handles UTF-8 characters and shows the hex bytes when the decoded data is not readable text.

Reviewed by the UseCalcForge editorial desk | Last updated
Before you paste

Base64 is not encryption.

Anyone can decode a Base64 string in one step. It is a way of carrying bytes through systems that only accept text, not a way of hiding them. Do not rely on it to protect passwords or API keys, and avoid pasting live secrets into any online tool, including this one.

RFC 4648 UTF-8 +33% size

Processed on our server. What you enter is sent over an encrypted connection, calculated, and returned. It is never written to a database or logged, and nothing is retained once the result is sent. Avoid entering passwords, API keys or other secrets. How we handle data

What Base64 does

Base64 rewrites any sequence of bytes using only 64 safe characters (A–Z, a–z, 0–9, + and /), so the data survives email bodies, JSON fields and HTTP headers that would otherwise mangle raw binary.

Data URIs

A small icon can be embedded straight into CSS or HTML as data:image/png;base64,…, saving one HTTP request. The cost is size: the encoded form is about a third larger than the original file, so it only pays off for very small assets.

Knowledge Base

How Base64 Encoding Works Methodology.

Base64 is a binary-to-text encoding defined in RFC 4648. It represents arbitrary bytes using 64 printable ASCII characters, which is what lets you put an image inside a JSON payload, send an attachment through email, or build an HTTP Basic Auth header. This tool encodes the text you type into Base64, or decodes a Base64 string back into readable text. Your input is sent to our server to be converted and is not stored or logged.

The Calculation Branch

3 bytes (24 bits) → 4 groups of 6 bits → 4 characters from the Base64 alphabet

Industrial Standards.

The encoder reads your text as UTF-8 bytes, takes them three at a time (24 bits), and splits each group into four 6-bit values. Each value (0 to 63) is looked up in the alphabet A–Z, a–z, 0–9, +, /. If the input length is not a multiple of three, the output is padded with one or two = signs. Decoding reverses the process. If the decoded bytes are not valid UTF-8 (for example, because the string was an encoded image), the tool shows them as hexadecimal instead of printing garbled characters.

In-Depth Analysis & Reference Data

A worked example. The word Man is three bytes: 77, 97 and 110, or 01001101 01100001 01101110 in binary. Regrouped into 6-bit chunks that becomes 010011 010110 000101 101110, which is 19, 22, 5 and 46. In the Base64 alphabet those are T, W, F and u, so Man encodes to TWFu. The two-byte word Ma leaves the last group short, so it is padded and the result is TWE=.

Why the output is longer. Every 3 input bytes become 4 output characters, so encoded data is about 33% larger than the original. A 30 KB image becomes roughly 40 KB of text. That is why inlining assets as data URIs makes sense for small icons but not for photos.

Base64 versus Base64URL. The standard alphabet uses + and /, both of which have special meaning in URLs. The URL-safe variant (also defined in RFC 4648, and used inside JSON Web Tokens) swaps them for - and _ and usually drops the padding. If a JWT segment fails to decode here, replace - with +, _ with /, and add = signs until the length is a multiple of four.

Common mistakes. Decoding fails if the string contains line breaks copied from an email, a stray space, or a data URI prefix such as data:image/png;base64,. Remove everything up to and including the comma first. And remember that Base64 offers no secrecy: a password stored as Base64 is effectively stored in plain text.

Frequently asked questions.

Does it handle accented letters and emoji?

Yes. Text is encoded as UTF-8 bytes first, so characters such as é, ñ or emoji survive the round trip. A single emoji can take four bytes, so it produces more Base64 characters than a plain letter.

Can I encode an image file here?

Not yet. This tool works on text you paste or type. If you decode a Base64 string that turns out to be an image or other binary file, it shows you the bytes in hexadecimal rather than the picture.

What is RFC 4648?

RFC 4648 is the IETF document that defines the Base64, Base32 and Base16 encodings, including the URL-safe Base64 alphabet. Output from this tool decodes correctly in any standard library, such as base64_decode in PHP, atob in JavaScript, or the base64 module in Python.

Estimates for planning. Always confirm against an authoritative source.