Encode text to Base64 or decode Base64 back to text.
What Is Base64?
Base64 is a way of representing any data, whether text, images or files, using only 64 safe characters: the uppercase letters A to Z, the lowercase letters a to z, the digits 0 to 9, plus the symbols + and /, with = used for padding at the end. Because those characters pass safely through almost every system, Base64 is widely used to move data through channels that were designed only for plain text. Our free Base64 Encoder / Decoder converts text to Base64 and back in your browser, with full UTF-8 support so emojis, accented letters and non-Latin scripts work correctly.
How Base64 Encoding Works
Computers store data as bytes, and each byte contains 8 bits. Base64 takes the data three bytes at a time, which is 24 bits, and splits those bits into four groups of 6 bits. Each 6-bit group has a value from 0 to 63, which is mapped to one of the 64 characters in the Base64 alphabet. If the data does not divide evenly into groups of three bytes, one or two = signs are added as padding at the end.
Because every 3 bytes become 4 characters, Base64 output is about 33 percent larger than the original data. That is the price paid for making binary data safe to send as text.
Common Uses of Base64
Email attachments
The MIME standard uses Base64 to send attachments such as images and PDFs through email systems that were originally designed only for text.
Data URIs in HTML and CSS
Small images, icons and fonts can be embedded directly in HTML or CSS as data URIs, such as data:image/png;base64, followed by the encoded image. This saves an HTTP request but increases file size, so it is best for very small assets.
APIs and JSON
JSON cannot contain raw binary data, so APIs often send files, images and signatures as Base64 strings.
Authentication headers
HTTP Basic Authentication combines a username and password with a colon and encodes them in Base64. Tokens such as JSON Web Tokens also use a URL-safe variant of Base64 for their parts.
Configuration and environment variables
Certificates, keys and multi-line configuration values are sometimes stored as Base64 so they fit on a single line.
Embedding data in URLs
URL-safe Base64 replaces + with – and / with _ so encoded data can sit inside URLs without additional percent-encoding.
Base64 Is Not Encryption
This is the most important thing to understand about Base64: it is an encoding, not a security measure. Anyone can decode a Base64 string in seconds with a tool like this one. Never use Base64 to hide passwords, API keys, personal data or anything sensitive. If information needs to be protected, use real encryption and secure storage, and use HTTPS when transmitting it.
You may sometimes find Base64 used to obfuscate scripts or links in suspicious emails and hacked websites. Decoding them can help you understand what the code does, but be careful never to run code you do not trust.
How to Use the Tool
Encode text to Base64
1. Paste or type your text into the input box.
2. Click “Encode to Base64”.
3. Copy the result from the output box.
The encoder first converts your text to UTF-8 bytes, so characters like é, ü, ñ, Arabic, Urdu, Chinese and emoji encode correctly, unlike some older tools that only handle basic English characters.
Decode Base64 to text
1. Paste the Base64 string into the input box.
2. Click “Decode Base64”.
3. Read or copy the decoded text.
The decoder ignores line breaks and spaces, accepts URL-safe Base64 with – and _ characters, and adds missing padding automatically. If the data is not valid Base64, or decodes to binary data such as an image rather than readable text, you will see a clear message instead of garbled output.
Standard vs. URL-Safe Base64
- Standard Base64 uses + and / and pads with =.
- URL-safe Base64 uses – and _ instead, and often omits padding.
Both represent the same data. Our decoder accepts either form, which is handy when you are inspecting tokens or URL parameters.
Base64 and Website Performance
Embedding images as Base64 in CSS or HTML can reduce the number of requests, but it has downsides: the encoded data is about a third larger, it cannot be cached separately from the file it is embedded in and it can delay rendering if the CSS becomes heavy. For most websites, it is better to serve images as normal files in modern formats like WebP, with caching and a CDN. Use Base64 only for tiny icons or critical inline graphics. You can check how heavy a page’s HTML has become with our Page Size Checker.
Base64 vs. Other Encodings
- URL encoding replaces unsafe characters in URLs with percent codes. Use our URL Encoder / Decoder for that job.
- Hexadecimal encoding represents each byte as two characters from 0 to 9 and A to F, doubling the size, and is common in debugging and hashes.
- Base32 uses a smaller alphabet that is case-insensitive, useful for codes people need to type, such as two-factor authentication secrets.
Practical Examples
Debugging an API response
An API returns a field containing eyJuYW1lIjoiQWF6eiJ9. Decoding it reveals {“name”:”Aazz”}, a small JSON object. You can then format larger JSON responses with our JSON Formatter.
Checking a Basic Auth header
An Authorization header contains a Base64 value. Decoding it shows the username and password pair, which is a good reminder of why Basic Authentication must always be used over HTTPS.
Preparing a value for a config file
A multi-line certificate or key can be encoded to a single Base64 line for storage in an environment variable, then decoded by the application at runtime.
Privacy
Encoding and decoding run entirely in your browser using built-in JavaScript functions. Nothing you paste is uploaded or saved on our server.
Quick Summary
Base64 makes data safe to move through text-only systems, adds about a third to its size and offers no protection at all. Use it for compatibility, never for secrecy.
Need Development Support?
Whether you are integrating APIs, building custom WordPress features or developing a SaaS product, the developers at Aazz Agency can help. Book a free consultation to discuss your project.
About the Base64 Encoder / Decoder
Base64 turns any text into a safe set of ASCII characters. It is commonly used in emails, data URLs and APIs. Encode or decode instantly, including emoji and non-English text.
How to use the Base64 Encoder / Decoder
- Paste your text or Base64 string.
- Click “Encode” or “Decode”.
- Copy the result.
Why use this tool?
- UTF-8 safe
- Accepts URL-safe Base64
- Private — runs in your browser
Frequently asked questions
Is Base64 encryption?
No. Base64 is an encoding, not encryption — anyone can decode it. Don’t use it to protect secrets.