Base64 Encode and Decode
Encode text or files to Base64 and decode Base64 back to text or a file. Supports UTF-8, URL-safe Base64 and data URLs. Runs in your browser.
0 characters
File to Base64
Base64 to file
Runs in your browser. Nothing you enter is uploaded.
How to use
This tool converts text and files to Base64 and back again.
Text
- Choose Encode to turn text into Base64, or Decode to turn Base64 back into text.
- Type or paste into the left box. The result updates as you type.
- Turn on URL-safe if the result goes into a URL or file name. It uses
-and_instead of+and/and leaves off the=padding. - Press Copy to copy the result, or Swap to move the result into the input and flip the mode.
Text is encoded as UTF-8, so accents, Chinese and Japanese characters, and emoji all survive the round trip. When decoding, spaces and line breaks are ignored, and a data: prefix is removed for you. If something is wrong, you see what and where, such as an invalid character at a given position.
Files
- Choose a file or drop it on the box. Its Base64 appears below. Turn on Output as data: URL to get a string you can paste straight into HTML or CSS, like an
imgsrc. - To go the other way, paste Base64 into Base64 to file. The tool recognises common types like PNG, JPEG, PDF and ZIP and suggests a file name. Change the name if you like, then press Download file.
Files over 10 MB are processed in the background so the page stays responsive. Very long results are shortened on screen, but Copy and Download always give you all of it.
Frequently asked questions
Is Base64 a form of encryption?
No. Base64 only changes how data is written so it can travel through systems that expect text. Anyone can decode it, so never use it to hide passwords or secrets.
Why is the Base64 output bigger than my file?
Base64 uses 4 characters for every 3 bytes, so the result is about 33% larger than the original. That is normal and the decoded file is exactly the same as the original.
What is URL-safe Base64?
It is a variant, also called base64url, that replaces + with - and / with _ and drops the = padding. The result can go into URLs, cookies and file names without extra escaping.
Related tools
- URL encoder Percent-encode or decode URLs and query strings in your browser.
- Hash generator Get CRC32, MD5, SHA-1, SHA-256 and SHA-512 hashes of text or files, make HMACs, and check a download against its checksum or a SHA256SUMS file.
- JSON formatter Format, validate and minify JSON in your browser, see it as a tree with paths, and fix JavaScript-style JSON.
More encoding tools
- JWT decoder Decode a JSON Web Token to see its header, payload and expiry, check its signature with a secret or public key (RS256, ES256), and sign a changed one.