Base64 Encoder/Decoder
Encode and decode Base64 text and files
How to use Base64 Encoder/Decoder
Encode and decode text or files to Base64 format instantly. Supports URL-safe encoding. Free online Base64 encoder tool.
What is Base64 encoding used for?
Base64 encodes binary data (images, files, bytes) into a text string using only 64 safe ASCII characters. This allows binary content to be transmitted through systems designed for text, like email or JSON APIs.
Common uses:
- Embedding images in HTML/CSS:
<img src="data:image/png;base64,iVBOR...">embeds images directly without a separate HTTP request — useful for small icons and email templates. - API authentication: HTTP Basic Auth sends credentials as
Authorization: Basic dXNlcjpwYXNz— the username:password encoded in Base64. - Email attachments: MIME protocol encodes binary attachments as Base64 so they can travel through email servers that only handle text.
- JWT tokens: JSON Web Tokens use Base64URL encoding (a URL-safe variant) for their header and payload sections.
- Data URIs: Fonts, SVGs and other assets can be embedded directly in CSS files using Base64 data URIs.
Important: Base64 is encoding, not encryption. Anyone can decode a Base64 string instantly. Never use it to hide sensitive data — use proper encryption instead.
Frequently Asked Questions
Is Base64 the same as encryption?
No. Base64 is an encoding scheme — it transforms data into a different format but provides zero security. It is completely reversible by anyone. Encryption (AES, RSA) uses a key to scramble data so only authorized parties can read it.
Why does Base64 increase file size?
Base64 represents every 3 bytes of binary data as 4 ASCII characters, adding approximately 33% overhead. A 100KB image becomes about 133KB when Base64 encoded. This is why embedding large images as Base64 is not recommended for performance.
What is the difference between Base64 and Base64URL?
Standard Base64 uses + and / characters which have special meanings in URLs. Base64URL replaces them with - and _ making it safe for use in URLs and filenames without percent-encoding. JWT tokens use Base64URL.
How do I decode a Base64 string in my browser console?
In the browser console, use: atob('your_base64_string') to decode and btoa('your_text') to encode. For binary data or files, the FileReader API is needed.
Can I Base64 encode any file type?
Yes — Base64 works on any binary data regardless of file type: images, PDFs, audio, executables. The resulting string can be stored in JSON, XML or HTML attributes.
Base64 vs other encoding schemes
Base64 is the most common text-safe encoding for binary data. Hex encoding uses only 0-9 and a-f — simpler but produces output twice the size of the original (200% overhead vs Base64's 33%). Base32 uses uppercase letters and digits 2-7, is case-insensitive and used in TOTP authenticator apps. URL encoding (percent-encoding) converts special characters for URLs — different purpose. For embedding binary data in text contexts, Base64 is the standard choice.