Skip to the tool

Base64 Encoder & Decoder

MDV Tools

Type text or Base64 on either side; the other side follows.

Runs on this device Works offline
encoding
paste text above
How this works

Base64 is an encoding, not encryption: it hides nothing, and anyone can reverse it in a second. It exists so bytes can travel through systems that only expect text. Typing on the left reads your text as UTF-8 bytes and runs them through the browser's own btoa. Typing on the right removes a leading data:…;base64, prefix if there is one and says so, with its media type; strips whitespace; restores missing = padding; runs atob; then decodes the bytes as UTF-8 — first strictly, and if that fails, leniently, in which case the tool says the bytes are not valid UTF-8 instead of pretending the replacement characters are your data. Bad Base64 is stopped at one problem, checked in this order and named with the character and its position (line and column once there are line breaks): the first character outside the alphabet, an = before the end, a single character left after the last group of four, which means the input was cut off, and more padding than the data takes.

URL-safe swaps - and _ in for + and / and drops the = padding, so the result survives a query string or a filename; decoding accepts either alphabet without being told. Wrap at 76 breaks the output into lines of 76 characters joined by a line feed (LF), with no break after the last line. MIME also caps lines at 76 characters but ends them with CRLF, and a text box holds only LF, so convert the line endings if the receiving program insists. Line breaks are not part of the data and are ignored on the way back. If you last typed in the Base64 field, the two toggles re-spell those same bytes there; the text is never encoded back, because for binary it is only a lenient reading.

What it refuses: it does not take files, so an image or a PDF has to go through a file tool, not this box. It will not pretend non-UTF-8 bytes are text — it decodes them, then tells you they are not text. A data: URL without ;base64 holds percent-encoded text, not Base64, and is refused. Text above 2,000,000 characters and Base64 above 2,800,000 characters, line breaks included, are refused rather than attempted, whether you typed them or the tool would write them, so the tab never hangs and whatever lands in a field can be edited again. Nothing is uploaded: there is no server in this file, and neither field is stored anywhere.

The Dark button remembers its setting in this browser's local storage. Nothing you type or drop into the page is stored.