Encode / Decode

Input Text (supports Unicode, HTML, JSON)
Base64 Output
What is Base64? Base64 is an encoding scheme that converts binary data into text format using 64 characters (A-Z, a-z, 0-9, +, /). It's commonly used for embedding images in HTML/CSS, API authentication tokens, and email attachments.
Advertisement
Advertisement

📖 How to Use

  1. Choose Encode or Decode from the tabs.
  2. Paste your text or upload a file.
  3. Click Encode/Decode.
  4. Copy the result with the Copy button.

❓ Frequently Asked Questions

What is Base64 encoding?

Base64 converts binary data (like images or files) into ASCII text so it can be safely transmitted in URLs, JSON, HTML, or email.

How do I decode a Base64 string?

Paste your Base64 string into the Decode tab and click Decode. The original text or file will appear instantly.

Can I encode an image to Base64?

Yes — upload an image file and it will be converted to a Base64 data URL that can be embedded directly in HTML/CSS.

Is Base64 a form of encryption?

No. Base64 is encoding, not encryption. Anyone can decode it. Do not use Base64 to secure sensitive data.

What is Base64 used for?

Common uses: embedding images in HTML/CSS, encoding email attachments (MIME), storing binary data in JSON/XML, and URL-safe data transport.

Base64 Encoding and Decoding — What It Is and When You Need It

Base64 is a binary-to-text encoding scheme that converts arbitrary binary data into a string of 64 printable ASCII characters. It was invented to solve a specific problem: older communication protocols (email, HTTP headers, XML attributes) were designed to carry text — but developers needed to transmit binary data (images, files, cryptographic keys) through those same channels without the binary bytes getting corrupted or misinterpreted as control characters.

The solution was to re-encode every 3 bytes of binary data as 4 ASCII characters using an alphabet of 64 safe characters: A–Z, a–z, 0–9, +, and /. The result is a larger string (roughly 33% overhead) but one that travels safely through any text-based protocol or data format.

How Base64 Encoding Works

The encoding algorithm processes input bytes in groups of three:

  1. Take 3 bytes (24 bits) of input data
  2. Split those 24 bits into four 6-bit groups
  3. Map each 6-bit value (0–63) to its corresponding character in the Base64 alphabet table
  4. If the input length is not divisible by 3, pad the output with = characters to make it a multiple of 4

Example: The string Man (bytes: 77 97 110 in decimal, or 01001101 01100001 01101110 in binary) encodes to TWFu. The three bytes provide 24 bits → four 6-bit groups (010011 / 010110 / 000101 / 101110) → values 19, 22, 5, 46 → characters T, W, F, u.

Common Use Cases for Base64

Use Case What Gets Encoded Why Base64
Email attachments (MIME)PDF, image, zip filesSMTP is text-only
Data URIs in HTML/CSSSmall images, fontsEmbed assets inline, eliminating HTTP requests
JWT tokensJSON payload + signatureURL-safe transport (uses Base64url variant)
API authenticationusername:passwordHTTP Basic Auth header format
Cryptographic keysSSL certificates, SSH keysPEM format stores keys as Base64 between headers
XML / JSON payloadsBinary file contentsXML/JSON cannot contain raw binary bytes

Who Should Use This Tool

Base64 vs URL Encoding — What's the Difference?

Base64 and URL encoding are both text-safe encoding schemes but serve different purposes:

Frequently Asked Questions

Is Base64 a form of encryption?

No. Base64 is encoding, not encryption. Anyone who receives a Base64 string can decode it instantly with no key. It provides zero security. Never use Base64 to "hide" passwords, API keys, or sensitive data — use proper encryption (AES-256) or hashing (bcrypt for passwords) instead.

Why does Base64 output end with = or ==?

Base64 works in groups of 3 bytes. If the input is not divisible by 3, padding characters (=) are added to make the output length a multiple of 4. One = means the last group had 2 bytes; == means 1 byte. Padding ensures decoders know exactly how many bytes of real data are present.

How do I decode a JWT token using this tool?

A JWT has three parts separated by dots: header.payload.signature. Copy the payload section (the middle part) and paste it into the decoder. Note: JWT uses Base64url encoding, so you may need to replace - with + and _ with / before decoding, then add = padding if needed. The decoded JSON will show you the token's claims.

Can I encode a file (PDF, image) with this tool?

The text encoder/decoder works with text strings. For encoding binary files to Base64 (for data URIs or API payloads), use the file upload mode which reads the file as binary and produces the complete Base64 string including the data URI prefix (e.g., data:image/png;base64,...).

Does Base64 make files larger?

Yes — Base64 increases data size by approximately 33% because every 3 bytes becomes 4 characters. A 1 MB image encodes to roughly 1.37 MB of Base64 text. This overhead is acceptable for small assets (icons, small images in CSS data URIs) but makes Base64 impractical for large file transfer where you should use multipart form upload instead.