Base64 Encoder/Decoder
Encode and decode text in Base64 format.
Overview
Encode text and binary data into Base64 format, or decode Base64 strings back to the original data. Commonly used for email attachments, data URIs, and API communication.
Formula
Base64 encoding process: Group input bytes into 3-byte (24-bit) chunks and split each into four 6-bit groups. Map each 6-bit value (0–63) to the character set A–Z, a–z, 0–9, +, / (64 characters). If the input length is not a multiple of 3, append '=' padding characters. The output size is approximately 4/3 of the original (about 33% larger).
How to Use
- 1Select encode or decode mode.
- 2Enter the text or Base64 string.
- 3The conversion result is displayed automatically.
- 4Copy the result for use wherever needed.
Tips
- ✔Base64 is encoding, not encryption. Do not use it for security purposes.
- ✔URL-safe Base64 uses '-' instead of '+' and '_' instead of '/'.
- ✔When using in a Data URI, prepend 'data:image/png;base64,' as a prefix.
- ✔You can estimate the original size from the encoded string length: original ≈ Base64 length × 3/4.
FAQ
Q. Why is Base64 encoding used?
Base64 is used to safely transmit binary data as text (ASCII). It is commonly used in email (MIME), embedding binary data in JSON/XML, and the Data URI scheme.
Q. How much does Base64 encoding increase data size?
Base64 encoding increases data size to approximately 133% (4/3) of the original. This is because 3 bytes of original data become 4 Base64 characters.
Q. What is the difference between Base64 and Base64URL?
Standard Base64 uses '+', '/', and '=' characters, while Base64URL uses '-' instead of '+' and '_' instead of '/' for URL safety, and may omit padding ('='). Base64URL is used in JWT and similar standards.
Related Calculators
Color Converter
Convert between HEX, RGB, and HSL color codes.
Unix Timestamp Converter
Convert between Unix timestamps and dates/times.
JSON Formatter
Format or minify JSON data for readability.
URL Encoder/Decoder
Encode and decode URL strings.
Hash Generator
Generate MD5, SHA-1, SHA-256 hash values.
Regex Tester
Test regular expressions and view match results.