Encode text to Base64 or decode it back, with UTF-8 support, URL-safe Base64URL, 76-character MIME wrapping and a hex view. In file mode, turn an image, PDF or any file up to 50 MB into Base64 or a data: URL, and turn it back into a downloadable file. Everything runs locally; nothing is uploaded.
Base64 (RFC 4648) writes any sequence of bytes as text using 64 ASCII characters: 4 output characters for every 3 input bytes. This tool has two modes. Text mode encodes UTF-8 text to Base64 and decodes Base64 back to text, with a URL-safe toggle for the Base64URL alphabet that JWTs use, a 76-character line wrap for MIME, and a hex view for bytes that are not text. File mode turns an image, a PDF or any other file into Base64 or a data: URL, and decodes Base64 back into a file you can preview and download. Files up to 50 MB stay in this tab; nothing is uploaded.
How the Base64 encoder/decoder works
Text mode: type on the left and press Encode, or paste Base64 on the right and press Decode. Encoding converts the text to UTF-8 bytes with TextEncoder before Base64, so accents and emoji survive the round trip. URL-safe swaps + and / for - and _ and drops the = padding. Wrap 76 inserts a line break every 76 characters, the MIME limit from RFC 2045. Hex shows the decoded bytes as two hex digits each, and switches on by itself when the bytes are not valid UTF-8. File mode: drop or choose a file to get its Base64, with an optional data:<type>;base64, prefix, or paste Base64 or a data: URL to get the file back. The file type comes from the data: URL or from the first bytes (PNG, JPEG, GIF, WebP, PDF and a dozen others), images and PDFs get a preview, and Download saves the file with the matching extension. Files are read with the browser's File API; no request carries them anywhere.
Limits
Files up to 50 MB. Outputs above 200,000 characters are previewed in the box and copied or downloaded in full.
~/faq
Frequently asked questions
Can I use Base64 offline?
Yes, once this page has finished loading. Encoding and decoding run as JavaScript in this tab, so disconnecting still works. Reloading or opening another tool may need a connection. The site does not install a service worker.
Does this handle UTF-8?
Yes. Plain btoa fails on emoji and non-Latin text with a “characters outside of the Latin1 range” error; this tool encodes the UTF-8 bytes first, so é becomes the two bytes C3 A9 and the round trip is exact.
How do I convert an image to Base64?
Switch to File mode and drop the image (PNG, JPEG, GIF, WebP, SVG or anything else) or click to choose it. The Base64 appears on the right. Turn on Data URL to add the data:image/png;base64, prefix that <img src> and CSS url() expect. Base64 is 4 characters for every 3 bytes, so a 30,000-byte PNG becomes 40,000 characters (+33.3%), plus 22 characters for the PNG data: prefix.
How do I decode Base64 to an image or PDF?
In File mode pick Base64 → File, paste the Base64 or the whole data: URL and press Decode. The type is read from the data: URL prefix or from the first bytes: 89 50 4E 47 is PNG, FF D8 FF is JPEG, 47 49 46 38 is GIF, 25 50 44 46 (%PDF) is PDF. Images and PDFs get a preview, and Download saves the file with the matching extension.
What is Base64URL and when do I need it?
Base64URL (RFC 4648 §5) is Base64 with the two characters that mean something inside URLs replaced: - instead of + and _ instead of /, with the = padding usually dropped. Use it wherever the string travels in a URL, a file name or a JWT; all three JWT segments are Base64URL. The URL-safe toggle switches both encoding and decoding to it.
Why does decoding show hex instead of text?
The Base64 decoded to bytes that are not valid UTF-8, so they are not text: an image, a compressed payload, a key, a hash. Rendering them as text would produce garbage, so the tool shows the bytes as hex, two digits per byte, and says so. To save those bytes as a file, use File mode.
Can I decode JWT segments here?
Yes, with URL-safe on: JWT segments use the Base64URL alphabet without padding. The JWT decoder shows all three segments as JSON in one step, which is faster for whole tokens.
Is whitespace allowed?
Yes. Decode strips spaces and line breaks before parsing, so Base64 wrapped at 76 characters from an email or a PEM file decodes as is.
Is there a file size limit?
50 MB. The file and its Base64 are both held in memory in this tab, and the Base64 alone is a third larger than the file, so the cap keeps the page responsive. Outputs above 200,000 characters are previewed in the box and copied or downloaded in full.
Is my text or file uploaded?
No. Text is encoded with JavaScript in this tab, and a file is read with the browser's File API into the tab's memory and encoded there. The network tab in your browser's dev tools shows no request carrying either.
Related tools
Chosen for the same job, not just the same category.