Base64 Encode / Decode
Encode text or files to Base64, decode Base64 strings, repair missing padding, switch to URL-safe Base64, and work with data URIs. Free and private in-browser tool.
Detected format
Paste standard Base64, Base64URL, or a data URI. The tool will detect the format automatically.
Preview
What this Base64 tool does
This page handles the most common Base64 workflows in one place: text encoding, Base64 decoding, Base64URL output for tokens and URLs, 76-character MIME wrapping, file-to-Base64 conversion, data URI generation, and binary download after decoding.
Common Base64 examples
Hello World!becomesSGVsbG8gV29ybGQhusername:passwordis often Base64-encoded for HTTP Basic Auth headers- Small images can be embedded as
data:image/png;base64,...strings - JWT segments and some signed URLs use URL-safe Base64 with
-and_
Base64 is encoding, not encryption
Base64 is useful because it makes binary data safe for text-only channels. It does not hide data. If someone can see the Base64 string, they can decode it. Use real encryption for secrets.
Code snippets
JavaScript
const encoded = btoa("Hello World!");
const decoded = atob(encoded); Python
import base64
encoded = base64.b64encode(b"Hello World!").decode("ascii")
decoded = base64.b64decode(encoded).decode("utf-8") When to use URL-safe Base64
Use the URL-safe option when the Base64 output will live inside query strings, cookies, JWT-like tokens,
or filename-safe identifiers. It replaces + with - and / with
_, and many systems also omit padding.