100% free
Base64 encoder/decoder
0 characters
0 characters
| Standard | URL-safe | Reason |
|---|---|---|
| + | - | + is read as a space in URLs |
| / | _ | / separates path segments in URLs |
| = | (removed) | = has a special meaning in query strings |
Used for: JWT tokens, file names, URL parameters, API keys
About Base64
Data URIs
Embed small images directly in HTML or CSS:data:image/png;base64,...
JWT tokens
JSON Web Tokens consist of three Base64-encoded parts separated by dots.
API auth
HTTP Basic authentication uses Base64 to transmit credentials.
How to encode text and files with Base64
- Choose the mode 'Encode' at the top.
- Type or paste your text, or upload a file with 'File'.
- The result appears right away in the output field. Turn on 'URL-safe' or 'Data URI' if you need them.
- Copy the output with 'Copy'.
The tool encodes text as UTF-8. Accented letters and other non-ASCII characters come back exactly as you typed them when you decode.
Decoding Base64
Switch to 'Decode' and paste the string. You don't need to clean it up first. The decoder removes spaces and line breaks and strips a leading data:...;base64, prefix on its own. It also accepts URL-safe strings with - and _ and a missing = at the end, without a switch.
It reads the result as UTF-8 text. If the string holds a binary file such as a PDF, the tool says the result is not valid UTF-8 text instead of printing garbage. If it is an image, the tool shows a preview instead. The swap button moves the output into the input of the other mode.
Embedding images as data URIs
If you upload an image with 'File', you get its Base64 value. With the option 'Data URI', the tool puts the matching prefix in front, for example data:image/png;base64,. For files it uses the type of the file. For typed text you pick the media type from the list, for example image/svg+xml or text/css.
The image preview recognizes PNG, JPEG, GIF, WebP, SVG and ICO from the first characters of the string and offers a download. This also works if you paste only the Base64 value without a prefix.
When the decoder shows an error
The message 'That isn't a valid Base64 string' usually means the string was cut off or contains characters outside the Base64 alphabet.
- Check that you copied the whole string, including the last characters.
- For a JWT, decode each of the three parts on its own. The dots are not part of Base64.
- Remove quotation marks if you copied the value from a JSON file.
Frequently asked questions
What is Base64 encoding?
What is URL-safe Base64?
What is Base64 used for?
Is Base64 encryption?
Why does Base64 make data bigger?
Can I convert files to Base64?
Is my data stored?
Can I decode Base64 to a PDF or another file?
Related tools
Changelog
November 20, 2026
Options apply to uploaded files
- • Fixed: after a file upload, URL-safe, Data URI and the media type now apply to the file. Before, the data URL text in the input field was encoded a second time.
- • Fixed: when you decode a Base64 image, only the image preview appears, no longer the UTF-8 error message as well.
- • The FAQ explains that files are also processed only in your browser and that binary data such as a PDF cannot be downloaded as a file.
November 18, 2026
Message for invalid UTF-8
- • When decoding binary data, the tool now reports "The result is not valid UTF-8 text" instead of silently printing replacement characters.
November 17, 2026
Guide and related tools
- • Added a guide with instructions and use cases directly below the tool.
- • Added related tools at the end of the page.
Show older versions
December 20, 2025
URL-safe Base64 and image preview
- • Added a URL-safe Base64 option (+ becomes -, / becomes _).
- • Added an automatic image preview for Base64-encoded images.
- • Added a data URI generator with a media type selection.
- • Added an image download button.
December 17, 2025
Launch
- • Encode text to Base64.
- • Decode Base64 to text.
- • Upload a file to get its Base64 value.
- • Copy with one click.
- • Real-time conversion.
- • Runs entirely in the browser.