Toolman

Base64 Encoder & Decoder

Convert text or files to Base64 and back. UTF-8 is handled correctly, URL-safe output is one click away, and files never leave your device.


File to Base64 / data URL

What Base64 actually does

Base64 maps arbitrary binary data onto 64 printable ASCII characters (A–Z, a–z, 0–9, +, /) so it can travel through channels that only accept text — email bodies, JSON fields, HTTP headers, XML documents or source code. Every 3 bytes of input become 4 characters of output, so encoded data is about 33% larger than the original.

Standard vs URL-safe

The standard alphabet uses + and /, both of which have special meaning inside URLs. The URL-safe variant (RFC 4648 §5) replaces them with - and _, and usually drops the trailing = padding. JSON Web Tokens use this variant, which is why a JWT contains no +, / or =.

Data URLs

A data URL embeds a file directly inside a document: data:image/png;base64,iVBORw0KGgo…. It removes an HTTP request, which is useful for tiny icons in CSS or single-file HTML exports. Because of the 33% size penalty it is a poor choice for anything larger than a few kilobytes.

Base64 is not encryption

Anyone can decode Base64 instantly — there is no key and no secret. It is an encoding, meant to preserve data across text-only transports, not a way to protect it. Never use it to hide passwords, tokens or personal data.

Frequently asked questions

Does this tool handle emoji and non-Latin text?

Yes. Text is converted to UTF-8 bytes before encoding using TextEncoder, so Chinese, Arabic, accented characters and emoji all round-trip correctly. Naive implementations that call btoa() directly throw an error on these inputs.

Why does my Base64 string end in one or two equals signs?

Base64 works on groups of three bytes. When the input length is not a multiple of three, = characters pad the final group so decoders know how many real bytes it held.

Are my files uploaded?

No. Files are read with the browser’s FileReader API and encoded locally. Nothing is transmitted, so the tool works offline and is safe for private documents.

How large a file can I convert?

Files up to a few tens of megabytes work fine. Beyond that the resulting string may exhaust the tab’s memory, since the encoded text is a third larger than the file itself.

Why does decoding fail with "invalid character"?

The input contains characters outside the Base64 alphabet — often a stray space, a line break from copy-paste, or URL-safe -/_ while standard mode is selected. Tick "URL-safe" or clean the whitespace and try again.

Related tools