Base64 Encoder / Decoder
Convert text to Base64 and decode Base64 strings back to plain text. Supports standard Base64 and URL-safe Base64 (used in JWTs and APIs). Bidirectional, live, and 100% offline — nothing is ever uploaded.
About Base64
Base64 encodes binary data as ASCII text using 64 characters (A–Z, a–z, 0–9, +, /). It's used in HTTP Basic Auth headers, JWT tokens, data URIs, and email attachments. URL-safe Base64 replaces + with - and / with _ to avoid conflicts in URLs. Encoding adds ~33% size overhead.
Features
Encode
Convert any text or ASCII string to Base64 in real time
Decode
Decode Base64 strings back to original plain text
URL-safe mode
Toggle between standard (+/) and URL-safe (-_) Base64 variants
Live conversion
Bidirectional — edit either side and the other updates instantly
Size stats
Shows original length, encoded length, and overhead percentage
Browser-only
Nothing is uploaded — runs entirely on your device
Common use cases
HTTP Basic Auth
Credentials in Authorization: Basic headers are Base64(username:password)
JWT tokens
All three parts of a JSON Web Token are Base64url-encoded
Data URLs
Embed images directly in HTML/CSS: data:image/png;base64,...
API payloads
Encode binary data (images, files) to send in JSON request bodies
Email attachments
MIME encodes binary email attachments as Base64
Config strings
Encode sensitive config values before storing in env files
Frequently asked questions
How do I encode a file to Base64?
This tool encodes text strings. To encode a binary file (image, PDF, etc.) to Base64, use the browser's FileReader API or a command-line tool: openssl base64 -in file.png -out file.b64 (macOS/Linux) or [Convert]::ToBase64String([IO.File]::ReadAllBytes("file.png")) in PowerShell.
Does Base64 work with Unicode/emoji?
Base64 encodes bytes, not characters directly. To encode Unicode text (including emoji), it must first be converted to UTF-8 bytes. This tool uses TextEncoder to handle UTF-8 correctly, so emoji and non-ASCII characters are supported.
What is the difference between btoa() and Base64?
btoa() is the browser's built-in Base64 encoder, but it only handles Latin-1 characters. For Unicode strings, you must first encode to UTF-8 bytes (via TextEncoder or encodeURIComponent) before passing to btoa(). This tool handles that conversion automatically.
Why does my decoded Base64 show garbled text?
If decoded output looks garbled, the original data was likely binary (an image, PDF, or other non-text file) rather than a text string. Base64 can encode any binary data, but decoding binary Base64 back to a string will not produce readable text.