Base64 Encoder / Decoder
Encode or decode Base64 strings, or convert a file to and from Base64 — instantly, in your browser
About this tool
The ToolNinja Base64 tool is a free online Base64 encoder and decoder. Encode any text or data to Base64 format, or decode Base64 strings back to plain text — instantly, with no page reload. Use the Base64 encoder when you need to embed binary data in JSON APIs, create data URIs for images in CSS or HTML, encode credentials for HTTP Basic Authentication headers, or prepare data for email transmission. Use the Base64 decoder to inspect encoded strings in API responses, JWT token segments, or any Base64 encoded content you encounter during development. Supports both standard Base64 and Base64URL encoding (used in JWT tokens and URLs), toggled with the Alphabet switch. The File mode handles arbitrary binary data directly: drop in any file to get its Base64 encoding, or paste a Base64 string to decode and download it back as a file — no command-line certutil or base64 CLI call needed. Runs entirely in your browser — your data never leaves your machine. No login, no server, no tracking.
When to use it
- →Encoding credentials for HTTP Basic Authentication headers
- →Embedding small images as data URIs directly in HTML or CSS
- →Storing binary data safely inside JSON or XML payloads
- →Decoding Base64-encoded strings from API responses or JWT tokens
- →Converting an arbitrary file (not just text) to Base64, or decoding one back to a downloadable file
Tips
- ◆Standard Base64 uses + and / — URL-safe Base64 replaces them with - and _ for use in query strings and JWT tokens. Switch alphabets with the toggle rather than hand-editing the output.
- ◆Every 3 bytes of input produce exactly 4 Base64 characters. = padding characters make the output length a multiple of 4 (URL-safe output omits the padding).
- ◆Base64 increases data size by ~33%. Don't use it for large files.
- ◆Switch to File mode to encode any file type — images, PDFs, archives — not just text, or to decode a Base64 string straight into a downloadable file.
Frequently asked questions
Is Base64 a form of encryption?
No. Base64 is encoding, not encryption. It is trivially reversible by anyone — there is no key, no secret, and no security involved. Never use it to protect sensitive data.
What's the difference between Base64 and Base64 URL-safe?
Standard Base64 uses + and / which have special meaning in URLs. URL-safe Base64 replaces + with - and / with _ so the encoded string can be used in URLs and HTTP headers without additional percent-encoding.
Why does my decoded Base64 show garbled characters?
This usually means the original data was binary (an image, file, or compressed payload) rather than plain text. Switch to File mode and paste the same Base64 string into the decode field there to get it back as a proper downloadable file instead of garbled text.
How do I Base64-encode a file, not just text?
Switch to File mode and drag the file in (or click to browse) — it encodes entirely in your browser and shows the Base64 output immediately, no upload involved.