Base64 Encoder & Decoder
Encode text to Base64 or decode Base64 back to text instantly. Supports Unicode, URL-safe mode, file encoding, and batch processing.
File to Base64 Converter
Upload any file — image, PDF, font, audio — and instantly get its Base64-encoded data URI. Max 5 MB. Everything stays in your browser.
Batch Encoder / Decoder
Process multiple values at once — one value per line. Each line is encoded or decoded independently.
How to Use This Tool
Everything you can do with this Base64 encoder and decoder in one place.
+→- and /→_. Use this for JWT tokens, URL parameters, and filenames that cannot contain those characters..txt file anytime.Everything Packed In
No installs, no accounts, no data leaving your device.
+/ with -_ and strips padding. Required for JWTs, OAuth tokens, and URL parameters.data:mime;base64,… string..txt file with one click. No clipboard size limits.Base64 Quick Reference
The key facts developers need to know about Base64.
Frequently Asked Questions
Everything you need to know about Base64 encoding and this tool.
Base64 is a binary-to-text encoding scheme that converts arbitrary binary data into a string of 64 printable ASCII characters. It exists because many text-based protocols — such as email (SMTP/MIME), HTTP headers, HTML attributes, and JSON — were designed for text only and cannot reliably transmit arbitrary binary bytes. Base64 bridges the gap, allowing binary data like images, certificates, and files to travel over these text channels without corruption.
No. Base64 is encoding, not encryption. It is completely reversible by anyone — no key or password is needed to decode it. It provides zero security or confidentiality. Never use Base64 as a way to "hide" or "protect" sensitive data like passwords, tokens, or personal information. For actual security, use proper encryption algorithms such as AES-256, RSA, or bcrypt (for passwords).
Standard Base64 uses + and / characters, which have special meanings in URLs (+ means space in query strings; / separates URL path segments). URL-safe Base64 (defined in RFC 4648 §5) replaces + with - and / with _, making the output safe in URLs, filenames, cookies, and HTTP headers without percent-encoding. Padding (=) is typically omitted too. Use URL-safe for JWTs, OAuth tokens, and any Base64 value that will appear in a URL.
Base64 increases the encoded size by approximately 33%. The math: every 3 bytes of input becomes 4 Base64 characters (each character representing 6 bits). So a 100 KB image becomes roughly 133 KB in Base64. When embedding images as data URIs in HTML or CSS, this overhead is a real cost — weigh it against the HTTP request saved. For large assets, a separate file request is typically more efficient.
Base64 processes input in 3-byte (24-bit) groups and outputs 4-character groups. When the input length is not a multiple of 3, padding characters (=) are added to make the output length a multiple of 4. One = means 1 byte was added; two == means 2 bytes were padded. URL-safe Base64 often strips padding since the decoder can calculate the original length from the character count alone.
Yes. Use the File to Base64 section on this page. Upload any image file (JPEG, PNG, GIF, SVG, WebP) up to 5 MB. The tool generates a complete data:image/...;base64,... data URI that you can paste directly into an HTML img tag's src attribute, a CSS background-image, or a <img src="..."> element. Images also preview inline so you can verify the encoding before copying.
The native browser function btoa() only accepts "Latin1" characters (code points 0–255). Unicode characters like emoji (🌍) or CJK characters have code points above 255, causing a DOMException: Failed to execute 'btoa' error. The solution is to first encode the string as UTF-8 bytes: btoa(unescape(encodeURIComponent(str))). This tool handles that automatically so you never need to worry about it.
No. All encoding and decoding happens entirely in your browser using native JavaScript APIs (btoa, atob, FileReader, TextEncoder). Your text, files, and Base64 strings are never sent to any server, never stored, and never logged. This makes the tool safe for sensitive payloads like API keys, tokens, and internal data.
A data URI embeds a file's full contents directly in a URL string. The format is data:[mime type];base64,[Base64 data]. For example: data:image/png;base64,iVBORw0KGgo…. Data URIs let you embed images, fonts, and small files directly into HTML, CSS, or JSON without a separate HTTP request. They're useful for email templates, single-file web pages, and small icons — but for larger files, separate requests are usually more performant.
JSON Web Tokens (JWTs) consist of three URL-safe Base64-encoded parts separated by dots: header.payload.signature. The header and payload are JSON objects encoded with URL-safe Base64 (no padding). The signature is computed over the header and payload using HMAC or RSA. Since the encoding is URL-safe, JWTs can be placed directly in HTTP headers, URL parameters, and cookies. Critically, the payload is only encoded — not encrypted — so anyone can read it by decoding it. Use JWE if the payload needs to be private.