Base64 Encoder & Decoder (UTF-8, URL-safe, Image to Base64)
Switch between standard Base64 and Base64url in your browser. The encoded text is not uploaded to JW Tool Box; the site separately collects usage information as described in the Privacy Policy.
Convert text, files, or images to Base64 instantly without server uploads.
The essential utility for converting raw text, binary blobs, or credentials into Base64 format locally. Instantly generate Basic Auth headers, encode complex SVG assets directly into your CSS files, or safely unwrap Base64url tokens like JWT fragments. Featuring robust, natively executed UTF-8 character support to completely eliminate frustrating "Latin1" mojibake.
How this page is maintained
- Steps and copy are checked against the current tool behavior.
- Browser limits, file-size constraints, or compatibility gaps are documented when relevant.
- Unless a page explicitly says otherwise, files and text stay in the browser during processing.
The Swiss Army Knife for Text Encoding
Base64 isn't encryption—it's a binary-to-text encoding scheme. It exists to solve a very specific problem: translating raw, unpredictable 8-bit bytes (like an image file, an encrypted token, or complex Unicode) into a universally safe, printable ASCII alphabet. This guarantees your data survives transmission across legacy protocols or strict text-only environments like JSON payloads and HTTP headers.
High-Impact Developer Workflows
- API Basic Authentication: Most REST APIs require credentials formatted as
base64(username:password)in the Authorization header. Our instant encoder is the fastest way to manually generate these tokens during Postman or cURL debugging sessions without typing out shell commands. - Frontend Optimization (Data URIs): To reduce aggressive HTTP request waterfalls on first-paint, developers frequently encode micro-assets (like SVG loading spinners or tiny placeholder logos) directly into CSS/HTML using data URIs.
- Safe URL Transmission: When you need to append a large object token to a URL, standard Base64 creates havoc because it contains characters like
+and/. Our tool features a dedicated Base64url Mode that intelligently swaps out these problematic characters (using-and_instead) and strips trailing padding, ensuring your tokens never shatter web routing logic.
True Built-in UTF-8 Saftey
If you've ever fed an emoji 🚀 or a Chinese character into an older online decoder only to get an error—or worse, mangled garbage strings—it's because naive implementations rely on JavaScript's outdated btoa() which only speaks Latin-1. Our engine utilizes modern TextEncoder APIs to safely marshal full UTF-8 streams into raw bytes before the Base64 math occurs.
How to Encode Text to Base64 and Decode It Back Again
This encoder works on text rather than files: it takes what you paste, converts it to UTF-8 bytes and then to Base64 characters. Accented letters, currency symbols and emoji all survive the round trip because of that UTF-8 step, which is where simpler implementations break. Two switches shape the output: the URL safe variant and the padding setting.
How to use it:
- Paste text and press encode, or paste Base64 and press decode. A short sample is loaded already encoded, so the shape of the output is visible before you type anything.
- Flip the variant switch when the value is heading into a query string or a URL. The URL safe alphabet replaces plus and slash with minus and underscore, so the three characters that encode to Pz8+ in the standard alphabet become Pz8- instead.
- Turn padding off when a consumer rejects the equals signs at the end, and leave it on when you need the canonical form.
Worked example. The eleven character string JW Tool Box encodes to SlcgVG9vbCBCb3g=. Base64 works in groups of three bytes, and each group produces four characters, so eleven bytes need four groups, which is sixteen characters: fifteen data characters plus one equals sign for the two leftover bytes. Longer text keeps roughly that ratio of four output characters for every three input characters, which is why a Base64 payload comes out about a third larger than the original. As a second check, café encodes to Y2Fmw6k=, where the trailing characters carry the two byte UTF-8 sequence for the accented letter rather than the single byte a Latin-1 encoder would have produced.
One warning matters more than any tip here. Base64 is an encoding, not encryption, and anyone can reverse it with a single function call, so it is never a way to hide an API key, a password or personal data. If a string starts with eyJ, that is a JWT and its middle segment is Base64 for JSON; the JWT decoder reads it without sending the token anywhere, and the URL encoder covers the percent encoding case. For the background and the image data URL use case, see the guide to converting images to Base64 for web performance.
Key features
- UTF-8 Safe Conversions: Robust support for Unicode characters (emojis, Asian scripts, accents). We use safe encoding practices to avoid the common "Latin1" errors found in older tools.
- URL-Safe Mode: Need a token for a URL? Toggle "URL Safe" to automatically swap `+` and `/` for `-` and `_`, making your string safe for query parameters.
- Instant Feedback: Type in the left box and see the result immediately. No "Submit" button required. Great for rapid testing of API credentials.
Frequently asked questions
Is Base64 encryption?
No. Base64 is an encoding scheme, not encryption. It makes binary data safe for text protocols (like HTTP or Email) but does not hide the data. Anyone can decode it.
What is the difference between Base64 and Base64url?
Base64url replaces + and / with - and _ and often drops padding (=) so values stay safe in browser address bars. The tool converts between them automatically.
Can I decode broken Base64?
The tool tries its best. If you have "dirty" Base64 with whitespace or newlines, we clean it up before decoding. However, missing characters will result in an error.
Is my text uploaded?
No. Encoding and decoding happen entirely in your browser using built-in functions and TextEncoder/Decoder.
Related guides
-
How to Convert Images to Base64 Online for Faster Web Loading (Free Tool)
Every time a user visits your website, their browser has to make a separate request for every single image file. If your site has dozens of small icons, logos, or UI elements, these requests can pile up and slow down your page load time. One powerful optimization technique is Base64 encoding. By converting your images into text strings and embedding them directly into your HTML or CSS, you can…