Base64 Encoder / Decoder
Encode and decode text or files as Base64, UTF-8 safe, with data URL output.
Text
Type or paste text; the output updates live. Encode / Decode set the direction, Swap flips it. Ctrl/⌘ + Enter runs again.
File to Base64
This file is larger than 5 MB, so the Base64 output is very long (about a third larger than the file). Copying and pasting it may be slow.
Base64 to file
How Base64 works
Base64 turns any sequence of bytes into plain text using 64 safe characters (A–Z, a–z, 0–9, + and /), padded with = at the end. Every 3 bytes become 4 characters, so the output is about 33% larger than the input. This tool encodes text correctly: it first converts your text to UTF-8 bytes, then encodes those bytes, so Chinese characters, accented letters and emoji round-trip where plain btoa() fails. Decoding reverses the process and reports when the input is not Base64 or decodes to binary rather than text. File mode turns any file into a Base64 string or a ready-to-use data URL.
Common questions
- URL-safe Base64 (RFC 4648 §5) replaces + with -, / with _ and drops the = padding, so it fits in a URL, file name or JWT. The decoder accepts both alphabets, with or without padding.
- Wrapping at 76 characters follows the MIME (email) convention. Line breaks and other whitespace are ignored when decoding.
- Base64 is an encoding, not encryption: anyone can decode it.
- To embed an image, paste the data URL output into an <img src="…"> attribute or a CSS url(). The MIME type comes from the file you picked.
- To turn Base64 back into a file, paste it in the last section, name it and download. A data URL prefix fills in the MIME type and suggests an extension.
Privacy
Text and files are processed with browser APIs on your device. Nothing is uploaded, so credentials, private documents and internal images are safe here.