Base64 ↔ UTF-8

Base64 encoder and decoder

Convert text or a local file to Base64, and decode Base64 back — with an honest hex view when the payload is binary rather than text.

UTF-8 bytes are counted, not characters.

Encoding and decoding happen in this tab. The text or file you load is never uploaded, and the downloaded file is written from browser memory.

Short answer: choose a direction, paste your value, and the result appears as you type. Encode works on UTF-8 bytes, so non-English text survives. Decode accepts the standard and URL-safe alphabets, with or without padding, and tells you when the bytes are binary instead of text.

What Base64 actually does

Base64 maps every three bytes to four printable characters from a 64-character alphabet, so any binary payload can travel through a channel that only carries text. It grows data by about a third. It hides nothing: there is no key and no secret, which is why a Base64 string in a URL is not a protected value.

UTF-8 first, always

Many encoders use btoa() directly on a JavaScript string, which throws on any character above U+00FF — so "₹", "नमस्ते" and emoji break. This page encodes the UTF-8 bytes of the string, which is what every modern API expects and whatBuffer.from(text).toString('base64') produces in Node.

Decoding safely

Need to inspect a token instead? The JWT decoder reads the three Base64URL segments and their claims.

Base64 questions

How do I encode text to Base64?

Choose Encode, type or paste the text, and the Base64 appears as you type. The text is converted to UTF-8 bytes first, so accented characters, Devanagari and emoji are encoded correctly instead of becoming question marks.

How do I decode Base64 to text?

Choose Decode and paste the Base64. Standard and URL-safe alphabets both work, with or without the = padding. If the decoded bytes are not valid UTF-8, the result is shown as hex and labelled — printing replacement characters would look like text but lose the data.

What is URL-safe Base64?

It replaces + with - and / with _, and usually drops the = padding, so the value can sit in a URL path, a query string, a filename or a JWT segment without escaping. Decoding accepts both alphabets, so you rarely need to know which one you have.

Can I Base64-encode a file?

Yes, up to 8 MB. The file is read locally and encoded in the tab; nothing is uploaded. Larger files are rejected with their real size rather than truncated, because a partially encoded file is worse than an error.

Is Base64 encryption?

No. Base64 is an encoding: anyone can reverse it without a key. It provides no confidentiality and no integrity. For secrets use encryption such as AES-GCM or libsodium, and for integrity use a SHA-256 digest.

Why does the output have line breaks?

You chose 64 or 76 characters per line, the conventions used by MIME and PEM. Line breaks are ignored when decoding, so the wrapped value round-trips through email and certificates.

Related tools