What is Base64?
Base64 is an encoding scheme that converts any data into a string of 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). It is used wherever binary data needs to travel over a text-only channel — email attachments (MIME), JSON payloads, HTTP Basic Auth headers, and data URLs in CSS and HTML.
Base64 is not encryption. It is trivially reversible and provides no security. Use it for encoding, not for hiding data.
Common use cases
- Embedding images in CSS as
data:image/png;base64,…
- HTTP Basic Auth headers —
Authorization: Basic dXNlcjpwYXNz
- Encoding binary data in JSON or XML payloads
- MIME email attachments
- JWT (JSON Web Tokens) — header and payload are Base64url-encoded
- Storing binary blobs as text in databases or config files
Frequently Asked Questions
What is Base64 encoding?
Base64 converts any data into a string of 64 printable ASCII characters. It is used to safely transmit binary data over channels that only handle text — such as email (MIME), JSON fields, and HTTP headers. Every 3 bytes of input produce 4 characters of output.
What is the difference between standard and URL-safe Base64?
Standard Base64 uses + and / as its 62nd and 63rd characters. These are reserved in URLs, so URL-safe Base64 (also called Base64url) substitutes - for + and _ for /. Use URL-safe when putting Base64 in a URL, filename, or JWT token.
Does Base64 encrypt my data?
No. Base64 is an encoding scheme, not encryption. Anyone with the Base64 string can decode it in seconds. It provides no confidentiality. For protecting sensitive data, use proper encryption such as AES-256.
Why does Base64 output end with = or ==?
Base64 works in groups of 3 bytes. If the input isn't a multiple of 3 bytes, padding characters (=) fill the gap to keep the output length a multiple of 4. One = means 1 padding byte; == means 2 padding bytes.
How much larger is Base64 output than the input?
About 33% larger. Every 3 bytes of input become 4 characters of output. A 300-byte file encodes to roughly 400 characters. This is the trade-off for making binary data safe to send as text.
How do I encode/decode Base64 in code?
JavaScript: btoa(str) to encode, atob(str) to decode.
Python: import base64; base64.b64encode(b'text') / base64.b64decode('...').
Shell: echo -n 'text' | base64 to encode, echo 'dGV4dA==' | base64 -d to decode.
Is this Base64 tool free?
Yes — completely free with no account or sign-up required. All encoding and decoding happens in your browser; your data never leaves your device.
How do I decode a Base64 string?
Switch to Decode mode using the toggle at the top, paste your Base64 string into the left pane, and the decoded plain text appears instantly on the right. The tool also accepts URL-safe Base64 strings (using - and _ instead of + and /).
How do I encode a string to Base64?
Encode mode is selected by default. Paste or type your text into the left pane and the Base64-encoded output appears on the right instantly. Toggle URL-safe if you need the output to be safe in URLs or JWT tokens.
What is Base64url (URL-safe Base64)?
Base64url is a variant of Base64 that replaces + with - and / with _, making the output safe to use in URLs, filenames, and HTTP headers without percent-encoding. It is used in JWT tokens, OAuth 2.0, and many modern web APIs.