What is Base64?
Base64 converts binary data into printable ASCII text using 64 safe characters (A-Z, a-z, 0-9, +, /). Because email, JSON, XML, and HTML can only carry text, Base64 is the standard way to embed binary payloads — images, files, and cryptographic keys — inside text fields. Every 3 bytes of input become 4 Base64 characters, making encoded output about 33% larger than the original.
How to use this tool
- 1 Choose Encode to convert plain text to Base64, or Decode to reverse a Base64 string back to text.
- 2 Paste your input — the output appears instantly as you type.
- 3 Check URL-safe (encode mode only) to replace + with - and / with _ and strip trailing = padding, producing a variant safe for URLs and filenames.
- 4 Use Swap to copy the output back into the input field, then switch modes to round-trip your data.
Frequently asked questions
Is Base64 the same as encryption?
No. Base64 is pure encoding — it changes the representation of data, not its secrecy. Anyone who sees a Base64 string can decode it instantly. Never use Base64 as a security measure; use AES or another real encryption algorithm when confidentiality matters.
What is URL-safe Base64?
Standard Base64 uses + and / which have special meaning in URLs. URL-safe Base64 replaces + with - and / with _ and often removes the = padding, producing a string you can safely embed in a URL without percent-encoding it. JWTs use URL-safe Base64 for their header and payload.
Is my data sent to a server?
No. Encoding and decoding both run locally in your browser using btoa and atob with a TextEncoder for full Unicode support. Your data never leaves your machine.
Why does my decoded output look garbled?
The Base64 string probably encodes binary data (an image, a PDF, a compressed archive) rather than UTF-8 text. This tool decodes to a UTF-8 string — binary data that does not represent valid UTF-8 will appear as garbled characters. Use a hex dump tool to inspect raw binary output.
What is the = padding at the end?
Base64 encodes in groups of 3 bytes. When the input length is not a multiple of 3, one or two = characters are added to pad the output to a multiple of 4. The URL-safe toggle removes this padding because it can be inferred from the string length.