What This Tool Does
This tool converts text, JSON, XML, or any UTF-8 string into Base64 encoding, and decodes Base64 strings back into readable text. Base64 is widely used for embedding binary data in JSON, email attachments, data URIs, and authentication tokens.
Inputs Explained
- Mode: Choose Encode (text → Base64) or Decode (Base64 → text).
- Input: Paste the text or Base64 string to convert.
- URL-safe: Optional. Replaces + with - and / with _ for safe use in URLs.
How It Works
The tool uses the browser's native btoa() for encoding and atob() for decoding, with a Unicode shim so that non-ASCII characters (emoji, Hindi, Chinese) are handled correctly via TextEncoder/TextDecoder.
Formula / Logic Used
Base64 Encoder & Decoder
Encode any text to Base64 or decode Base64 back to readable text. Runs entirely in your browser.
Step-by-Step Example
Mode: Encode
Input: Hello, BulkCalculator!
Output: SGVsbG8sIEJ1bGtDYWxjdWxhdG9yIQ==
Reverse decode returns the original string. URL-safe mode replaces + and / with - and _ so it works in URLs and JWT tokens.
Use Cases
- API authentication: Encode user:password as Base64 for HTTP Basic Auth headers.
- JWT token inspection: Decode the header and payload portions of a JSON Web Token.
- Email attachments: Inspect or generate the Base64 sections inside MIME-encoded emails.
- Data URIs: Encode small images or files as data: URIs for embedding in HTML or CSS.
- Webhook debugging: Decode Base64 payloads sent by services like AWS SNS or Stripe.
Assumptions and Limitations
- Base64 is encoding, not encryption. Anyone can decode it. Never use Base64 to hide passwords or secrets.
- Encoded data is roughly 33% larger than the source. A 1 MB input becomes ~1.33 MB Base64.
- Very large inputs (>10 MB) may slow your browser. The tool is best for text strings, not large binary files.
- URL-safe mode strips trailing = padding. The decoder re-adds it automatically, but other tools may need padding.
Frequently Asked Questions
Is Base64 encryption?
No. Base64 is encoding, which is reversible without a key. Anyone can decode a Base64 string. Use proper encryption (AES, RSA) to protect sensitive data.
Why does my decoded text look corrupted?
The input may not be valid Base64, or it may be Base64 of binary data (like an image) rather than text. Check that the input contains only A-Z, a-z, 0-9, +, /, and = characters.
What is URL-safe Base64?
Standard Base64 uses + and / which have special meaning in URLs. URL-safe Base64 replaces them with - and _ and removes the trailing = padding so the result can be safely used in URLs and filenames.
Can I encode binary files like images?
This tool focuses on text. To encode an image, use a dedicated image-to-Base64 tool that accepts file uploads. The text encoding logic is the same.
How is Base64 used in JWT tokens?
A JWT consists of three URL-safe Base64 sections separated by dots: header, payload, signature. The first two can be decoded to inspect the token's contents. The signature requires the secret key to verify.
Will Base64 reduce file size?
No, the opposite. Base64 increases size by approximately 33%. It is used for compatibility (text-only channels), not compression.
Is my data sent anywhere?
No. Both encode and decode run entirely in your browser using native JavaScript functions. There is no network call when you click Convert.
Why use Base64 at all?
To safely transmit binary data through systems that only handle text — emails, JSON APIs, URL parameters, HTML attributes, and many database fields. It guarantees the data survives without corruption.
Sources and References
- RFC 4648 — Base16, Base32, Base64 Encodings — Official IETF specification for Base64.
- MDN — btoa() — Browser API used for encoding.
- MDN — atob() — Browser API used for decoding.
- Wikipedia — Base64 — Background on Base64 origins and uses.