Base64 Encoder & Decoder
Text is turned into UTF-8 bytes before it is encoded, so non-English input never throws or comes back garbled. Decoding accepts standard, URL-safe and line-wrapped Base64 automatically and tells you exactly what is wrong when the input is not valid.
Decoding reads all three spellings automatically, so this choice only shapes the encoded result and is switched off while you decode.
No file selected yet.
Or drop a file anywhere onto this box.
The file is read into memory here and never uploaded.
The result appears here as you type.
A data: URL is for embedding - an image src, a CSS background, a bookmarklet - not for sending to an API: it costs the same 4/3 expansion plus the prefix, and most servers cap request bodies long before that. The prefix uses the file type your browser reported, falling back to application/octet-stream.
Input Output Output / input
Nothing leaves this page. Both directions run in this tab with the browser built-in TextEncoder and TextDecoder, and the only thing stored on your device is the three choices above.
How to use
- Choose Encode or Decode, then type or paste into the input box — or switch the source to File and pick a file, which is read in your tab and never uploaded.
- When encoding, pick the variant: standard with = padding, base64url (- and _, no padding) or MIME with 76-character lines. Decoding reads all three on its own.
- Read the result and the size note: the status line states how many bytes went in, how many characters came out and whether decoding the result again returns your input exactly.
- Use Copy result, Download .txt, or Wrap as data: URL to embed an image or file. If decoded bytes are not text, a hex byte view is shown instead of garbage.
Frequently asked questions
Why does btoa fail on Chinese or emoji?
The built-in btoa only accepts characters whose code is below 256, so anything outside Latin-1 throws an error, and a naive workaround returns mojibake when decoded. This tool encodes the text to UTF-8 bytes first and puts those bytes through Base64, then reverses the same steps, so any text survives the round trip.
What is the difference between standard, base64url and MIME?
They share the same data; only the spelling differs. Standard uses + and / with = padding. base64url swaps them for - and _ and drops the padding so the value is safe in URLs and JWTs. MIME is standard Base64 broken into lines of 76 characters, as used in email. Output is always about 4/3 the size of the input.
Is my text or file uploaded?
No. Both directions run in this tab using the browser’s TextEncoder and TextDecoder, and a file is read into memory locally. Only your three option choices are remembered on this device. Base64 is encoding, not encryption, so do not treat it as a way to hide secrets.
Guides
Related tools
JSON Formatter & Validator
Paste JSON to format, minify or validate it, with the exact line and column of any syntax error. Works offline and never uploads your data.
Unix Timestamp Converter
Convert a Unix timestamp to dates across time zones, or a date back to seconds and milliseconds. The assumed unit is always shown. Runs in your browser.
UUID Generator
Make 1 to 1000 UUIDs locally with the browser CSPRNG, including time-ordered v7 per RFC 9562. Copy the list or download a .txt. Nothing leaves your device.