Base64 Encode Decode: Text and Files
Encode text or a file to Base64, or decode Base64 back to text or a downloadable file. URL-safe Base64 and data URLs work too.
How to Base64 encode and decode
- To encode, type or paste text into the Input box and press Encode. The Base64 updates as you type. Text is encoded as UTF-8, so emoji and Hindi work.
- To decode, paste Base64 (or a whole
data:URL) and press Decode. Line breaks, missing=padding and URL-safe-/_are all accepted. - To encode a file or image, choose it or drop it on the file box. Tick Data URL to get a
data:image/png;base64,…string you can use in HTML or CSS. - If decoded Base64 is a file rather than text, press Download file to save it. Images are previewed. Use Copy for text and Swap to send the output back as input.
Everything runs in your browser. Nothing you paste or type is uploaded or saved.
Frequently asked questions
Is Base64 encryption? Can it hide a password?
No. Base64 is an encoding, not encryption: anyone can decode it in one step, without a key. Use it to move binary data through text-only places (JSON, email, URLs, HTML), never to protect secrets. Hash passwords with bcrypt or Argon2 and encrypt sensitive data with a real cipher.
Why does btoa() fail on emoji or Hindi text in JavaScript?
btoa() only accepts characters with codes 0 to 255, so "नमस्ते" or an emoji throws "InvalidCharacterError". Convert the text to UTF-8 bytes first, for example with new TextEncoder().encode(text), and Base64-encode those bytes. This tool does exactly that, so its output matches Node.js Buffer.from(text).toString("base64").
What is URL-safe Base64 (base64url)?
Standard Base64 uses + and /, which have special meanings in URLs and file names. URL-safe Base64 replaces them with - and _ and usually drops the = padding. JWTs use it. Tick URL-safe to encode that way; the decoder accepts both forms automatically.