What Is Base64?
Base64 is a binary-to-text encoding scheme that represents binary data using 64 ASCII characters (A-Z, a-z, 0-9, +, /). It's not encryption — it's encoding. Anyone can decode it instantly. Its purpose is to safely transmit binary data through text-only channels.
When to Use Base64
Embedding small images in CSS/HTML: For icons under 2-4KB, Base64 data URIs eliminate an HTTP request. Convert small icons with our Image to Base64 tool.
Email attachments (MIME): Email protocols are text-based, so binary attachments must be Base64-encoded. This happens automatically — you don't need to do it manually.
JWT tokens: JSON Web Tokens use Base64URL encoding for the header and payload. Understanding the structure helps you debug auth issues — decode JWTs with our JWT Decoder.
API payloads: When an API needs to accept binary data in a JSON body (which only supports text), Base64 is the standard approach.
When NOT to Use Base64
Large images: Base64 increases file size by ~33%. A 100KB image becomes 133KB. For anything over 4KB, a regular image file with proper caching is faster.
"Security": Base64 is not encryption. It takes one second to decode. Never use it to "hide" passwords, API keys, or sensitive data. Use our Hash Generator for actual security hashing.
Large file storage: Storing files as Base64 in databases wastes 33% more storage and makes queries slower. Use proper binary storage (BLOB) instead.
The 33% Size Overhead
Every 3 bytes of binary data become 4 bytes of Base64 text. That's exactly 33.33% overhead. For small assets, the saved HTTP request outweighs this. For larger files, it's pure waste.
Base64 vs Base64URL
Standard Base64 uses + and / which are special characters in URLs. Base64URL replaces them with - and _ and removes padding (=). JWTs and URL parameters use Base64URL.
Encode and Decode Instantly
Use our Base64 Encoder and Base64 Decoder for text. For images specifically, try Image to Base64 (with data URI output) or Base64 to Image to decode back to a viewable image.