How to use the Base64 encoder and decoder
- Pick a tab. Text ↔ Base64 converts plain text in both directions, File → Base64 turns any file into a Base64 string or data URI, Base64 → File rebuilds a file from Base64 and Hex / URL offers hexadecimal and percent-encoding.
- Paste your text or drop your file, then press the matching button. Results appear in the read-only box underneath.
- Use the copy button to place the result on your clipboard. For images, the tool also prepares a ready-made HTML
imgtag and a CSSbackground-imagerule. - To get a file back from Base64, paste the string or the whole data URI, optionally type a file name, and press Download as file. The file type is detected automatically.
What is Base64?
Base64 is a way of writing any data, including text, images and documents, using only 64 safe characters: the letters A to Z and a to z, the digits 0 to 9, plus and slash, with an equals sign used as padding. These characters survive almost every system that handles text, such as email, JSON, XML and URLs, which were never designed to carry raw binary bytes. Every three bytes of input become four characters of output, so Base64 data is about 33 percent larger than the original.
The name comes from the size of the alphabet, and the scheme has been standardized for decades. You meet it whenever you see a long string of letters and digits ending in one or two equals signs, for example in an email attachment, an API token, a certificate file or an image embedded straight into a web page. This page lets you create and read those strings without installing anything.
| Input text | Base64 output |
|---|---|
Hello | SGVsbG8= |
Hello, World! | SGVsbG8sIFdvcmxkIQ== |
café | Y2Fmw6k= |
user:pass | dXNlcjpwYXNz |
The text conversion uses UTF-8, the encoding used almost everywhere on the web. That is why accented letters, symbols and emoji round-trip correctly. Older tools built on the browser's raw btoa() function fail on such characters, and this tool avoids that problem.
Standard and URL-safe Base64
The plus and slash characters of standard Base64 have special meaning in web addresses and file names. A URL-safe variant, defined in the same standard, replaces them with a hyphen and an underscore and usually drops the padding. It is the form you find in JSON Web Tokens and many query parameters. Tick the URL-safe box when encoding, and the decoder accepts both variants automatically.
Common uses for Base64
- Data URIs: embedding a small icon or logo directly in HTML or CSS avoids an extra network request. The File tab outputs the complete
data:image/png;base64,...string and the code snippets. - APIs and JSON: sending a file or binary value inside a JSON field, because JSON cannot carry raw bytes.
- Email: attachments are carried as Base64 by the MIME standard, which is why raw email source contains long blocks of letters and numbers.
- HTTP Basic authentication: the Authorization header holds
username:passwordencoded as Base64. It is encoded, not encrypted, so only use it over HTTPS. - Configuration and certificates: PEM files and Kubernetes secrets use Base64 to store keys and values as text.
- Debugging: decoding a suspicious string in a log file or a token payload to see what it contains.
Base64 is not encryption
This point is worth repeating because it causes real security incidents. Anyone can decode a Base64 string instantly, with this page or with a single command. Never rely on it to hide passwords, API keys or personal data. If you must protect information, use real encryption with a strong key, or better, avoid putting secrets in text that others can read. For creating strong passwords, use the Password Generator on this site.
Hex and URL encoding
The last tab handles two other everyday conversions. Hexadecimal shows each byte of your text as two characters from 0 to 9 and a to f, which is useful when you inspect protocols, color codes, hashes or file headers. The decoder accepts spaces, commas, colons and 0x prefixes between the bytes. URL encoding, also called percent-encoding, replaces unsafe characters with a percent sign and two hex digits, so a space becomes %20 and the letter é becomes %C3%A9. Use it for query-string values. Decoding also treats a plus sign as a space, as form submissions do.
Troubleshooting decoding problems
If decoding fails, the message tells you what to check. The most common cause is a copy-and-paste error: a missing character at the end, an extra quote or a line break in the middle. Line breaks and spaces are ignored, but other symbols are not. If the string comes from a URL, it may be the URL-safe variant, which this tool handles automatically. If the decoded bytes are not text, the tool will say so, and you can download them as a file instead. A string that starts with iVBOR is usually a PNG image, /9j/ is a JPEG and JVBER is a PDF, so the first characters often reveal what the data is.
File size and performance
Files up to a few megabytes convert in a moment. Because the output is a third larger than the input and is shown in a text box, files over 5 MB trigger a warning and files over 50 MB are refused to protect your browser. For embedding in a web page, keep Base64 images small, preferably below 10 KB. Larger images are better served as regular files, since Base64 prevents separate caching and increases page weight. You can reduce an image first with the Compress Image tool on this site.
Private by design
Your text and files are converted by JavaScript inside this browser tab. Nothing is uploaded, logged or stored, and the page works offline after the first visit. Because Base64 strings often contain tokens and credentials, a tool that never transmits your input is the safest way to inspect them.
Frequently asked questions
What is Base64 encoding used for?
Base64 represents binary data, such as images or documents, using only text characters so that it can travel safely through systems built for text, like email, JSON, XML and URLs. It is also used for data URIs, HTTP Basic authentication headers, tokens and certificate files.
Is Base64 the same as encryption?
No. Base64 only changes how data is written and can be reversed by anyone in a second. It gives no confidentiality. Do not use it to protect passwords or sensitive information; use proper encryption or keep secrets out of shared text.
Why does the Base64 version of my data end with = signs?
Base64 works in groups of three bytes. When the input length is not a multiple of three, one or two equals signs are added as padding so the output is a multiple of four characters. URL-safe Base64 often leaves the padding out, and this decoder accepts both forms.
Why is Base64 about 33 percent bigger than the original?
Every three bytes of input (24 bits) are written as four Base64 characters of 6 bits each, so the output is four thirds the size of the input. Line breaks or prefixes add a little more. That overhead is the price of making binary data text-safe.
Can I decode Base64 back into an image or PDF?
Yes. Use the Base64 → File tab, paste the string or data URI and press Download. The tool guesses the file type from the data URI or from the file signature and adds a matching extension if you do not type one.
What is URL-safe Base64?
It is a variant that replaces the plus sign with a hyphen and the slash with an underscore, and normally omits the = padding, so the result can be used in URLs and file names without escaping. JSON Web Tokens use this form. Tick the URL-safe box to create it; decoding accepts either variant.
Does it handle accents, emoji and non-English text?
Yes. Text is converted to UTF-8 bytes before encoding and decoded as UTF-8 afterwards, so characters like é, ü, 日本語 and emoji survive a round trip. Tools that use the plain btoa() function in a browser often fail on those characters.
Are my files uploaded to a server?
No. Files are read and converted by your browser, in memory, and are never sent anywhere. The page can be used offline after it has loaded. Files over 5 MB trigger a warning and files over 50 MB are not processed to avoid freezing the tab.
Related tools
Need custom software, a faster website or help with digital projects? The team at Bilişim Ajans can help.