moim.bio

Base64 Encode

Turn text or a file into a Base64 string. Pick the URL-safe alphabet and the line-wrap width you need.

What Base64 actually does

Base64 rewrites arbitrary bytes using only 64 characters: A–Z, a–z, 0–9, + and /. It is not encryption. Anyone can reverse it in a second, so it is never a way to hide a password.

You use it because the channel only accepts text. Mail bodies, JSON values, HTML attributes and cookies cannot carry raw binary, so a file riding through one of them has to be spelled out in safe characters first. The cost is size: the result is about 33% larger than the original.

Choosing the options

Where it is goingSettings
A JSON value, general useLeave the defaults
A URL query string, a JWTURL-safe + strip padding
A mail attachment (MIME)Line wrap 76
A certificate or key (PEM)Line wrap 64

URL-safe swaps + for - and / for _. Drop ordinary Base64 into an address unchanged and the + is read as a space while the / is treated as a path separator — the value arrives corrupted.

Non-ASCII text

This tool converts your text to UTF-8 bytes first, then encodes. A character outside ASCII usually takes two to four bytes, so one such character becomes several Base64 characters. If you have ever called JavaScript's btoa() on non-Latin text and got an InvalidCharacterError, that is why: btoa() skips the UTF-8 step and refuses anything above U+00FF.

Making a data URI for an image

Drop the image file on the input box and put the MIME type in front of what comes out.

<img src="data:image/png;base64,PASTE_RESULT_HERE">

For an icon of a few kilobytes this saves one request. For a large image it costs you: a data URI sits inside the HTML or CSS, so it is never cached on its own and gets downloaded again on every page load. If you already have a data URI and want to go the other way, use the Data URI to Image tool.

Is what I paste sent to a server?

No. After the page itself loads, this tool uses no network at all. Open your browser's Network tab, run a conversion, and you will see that not one request leaves.

How large a file can I encode?

Up to 16 MB. Beyond that the browser has to hold a very large string in memory and the tab tends to freeze, so the limit is deliberate.

23 more tools