How Base64 works
Computers store everything as bytes, but many systems (email, URLs, JSON, HTML attributes) only handle plain text safely. Base64 bridges the gap. It takes the data three bytes (24 bits) at a time and splits it into four 6-bit groups. Each 6-bit group is a number from 0 to 63, written as one character from the Base64 alphabet.
When the input isn't a multiple of three bytes, one or two "=" signs pad the end. Because every 3 bytes become 4 characters, Base64 output is about 33% larger than the original.
Base64 is not encryption
Anyone can decode Base64 instantly; it only changes the format. Never use it to hide passwords or secrets. It's often seen in places like HTTP Basic authentication headers, where it's only safe because the connection itself is encrypted with HTTPS.
Text and UTF-8
Plain browser functions like btoa() fail on emoji and many non-English characters. This tool first converts text to UTF-8 bytes, so "Ça va? 👋" encodes and decodes correctly, matching what Python, Java, PHP and command-line tools produce.
URL-safe Base64
Standard Base64 uses "+" and "/", which have special meanings in URLs. The URL-safe variant (also called base64url) replaces them with "-" and "_" and usually drops the "=" padding. It's used in JSON Web Tokens (JWTs), URL parameters and file names. The decoder accepts both forms automatically.
Data URIs for images and files
A data URI embeds a file directly in HTML or CSS:
This saves a network request for tiny images like icons, but makes the HTML or CSS bigger and stops the browser caching the image separately. As a rule, only inline files under a few kilobytes.
Frequently asked questions
How do I decode Base64 to text?
Switch to Decode and paste the Base64. The decoded text appears instantly. Data URIs and URL-safe Base64 are handled automatically.
Is Base64 encryption?
No. Base64 is an encoding that anyone can reverse. It doesn’t protect data.
Why is Base64 bigger than the original?
Every 3 bytes become 4 characters, so Base64 is about 33% larger than the original data.
How do I convert an image to Base64?
Drop the image on the file box. You get a complete data URI you can paste into an HTML img tag or CSS.
What is URL-safe Base64?
A variant that uses - and _ instead of + and /, and usually no = padding, so it can be used in URLs and file names.
Last updated October 2026 · More developer tools