Base64 encode and decode
Encode text or files to Base64 and decode Base64 back. Text is handled as UTF-8, URL-safe Base64 and data URLs are supported, and decoded data can be saved as a file.
Base64 is an encoding, not encryption. Anyone can decode it, so it does not hide passwords or secrets.
Accepts standard (+ /) and URL-safe (- _) Base64, with or without = padding. You can also paste a data URL (data:…;base64,…).
Ready to embed in HTML or CSS. Data URLs use standard Base64, so the URL-safe option is ignored.
Hex dump of the first 256 bytes
Files you select are processed in your browser on this device. They are never uploaded to or stored on our server. For how analytics are handled, see the Privacy Policy.
How to use
- Choose "Encode" or "Decode".
- To encode, choose "Text" or "File". A chosen file is encoded right away. Turn on "Output as a data URL" to embed it in HTML or CSS, or "URL-safe" for use in URLs and file names.
- To decode, paste Base64 or a data URL (data:…;base64,…) and press "Decode". Standard and URL-safe Base64 are detected automatically.
- Copy the result or use "Save as file". "Use result as input" lets you convert back right away.
Supported formats and limits
- Text input up to 5 MB and files up to 5 MB.
- Text is treated as UTF-8. Base64 made from text in another encoding cannot be turned back into readable text here. Line breaks typed into the box are encoded as LF (browser behavior).
- If the decoded data is not UTF-8 text (for example an image), it is not shown as text; a hex dump and a save button are shown instead. The file extension comes from the data URL type or the first bytes (PNG, JPEG, GIF, WebP, PDF, ZIP and a few more), otherwise .bin.
- Data URLs always use standard Base64, so the URL-safe option is ignored for them. Data URLs that are not Base64 (no ";base64,") cannot be decoded.
- Base64 is not encryption. Anyone can decode it.
How it works
Encoding converts text to UTF-8 bytes, or takes a file as raw bytes, and then applies Base64 as defined in RFC 4648. URL-safe output uses - and _ instead of + and / and omits the trailing = padding.
A data URL is "data:<file type>;base64," followed by the Base64 (RFC 2397). The file type is the one your browser reports for the file.
Decoding accepts both the standard and the URL-safe alphabet. Spaces and line breaks are ignored, and missing = padding is tolerated. Any other character is reported with its position.
The decoded bytes are read as strict UTF-8. If they are not valid UTF-8, no garbled text is shown; the tool says the data is not text.
FAQ
Can Base64 encrypt my data?
No. Base64 only represents data as text, and anyone can reverse it. Do not use it to protect secrets.
Can I turn an image into Base64 or a data URL?
Yes. Choose "File", select the image and, if needed, turn on "Output as a data URL". The result works directly in <img src="…"> or CSS url().
What is URL-safe Base64?
A variant (base64url in RFC 4648) that replaces + and /, which have special meaning in URLs and file names, with - and _. The trailing = is usually dropped. Decoding reads both variants automatically.
Decoding says the data is not UTF-8 text.
The original data is binary (such as an image) or text in another encoding. The save button keeps the bytes exactly as decoded.
Are my input and files sent anywhere?
No. Everything runs in your browser, and nothing you enter or choose is stored or sent.
Related guides
- Base64 is not encryption: encoding, encryption and hashing explainedWhat Base64 actually does, why it does not protect secrets, how it differs from encryption and hashing, and how to encode and decode text and files.
Related tools
Last updated: