Tools / Base64 Encoder/Decoder


                            
                        

                            
                        

📚 About Base64 Encoding & Decoding

Everything you need to know about Base64 encoding and how to use this tool effectively

What is Base64?

Base64 is a binary-to-text encoding scheme that converts binary data into a text format using 64 printable ASCII characters. It's widely used for:

  • Email transmission: Encoding attachments and special characters
  • Data URLs: Embedding images in HTML and CSS
  • API communication: Safely transmitting binary data over text protocols
  • Authentication: Encoding credentials in HTTP Basic Auth
  • Data storage: Storing binary data in databases that only support text

How It Works

Encoding Process:

  1. Convert text to binary (8 bits per character)
  2. Group binary into 6-bit chunks
  3. Convert each 6-bit group to decimal (0-63)
  4. Map decimal to Base64 alphabet characters
  5. Add padding characters (=) if needed

Decoding Process:

Reverse the encoding process to recover the original text

Tool Features

  • Instant encoding and decoding
  • Support for text and binary data
  • Handles special characters and Unicode
  • Copy to clipboard functionality
  • Line numbers for easy reference
  • Auto-detection of Base64 format
  • Works 100% in your browser (no server upload)

Common Use Cases

  • Encoding Images: Convert images to Data URLs for embedding
  • API Integration: Encode credentials for authentication headers
  • Email Attachments: Encode files for email transmission
  • Web Development: Embed fonts, icons, or small images
  • Data Transfer: Safely transmit binary data over text protocols
  • Debugging: Decode and inspect Base64 encoded data

How to Use This Tool

🔐 To Encode Text:
  1. Paste or type your text in the Input Text area
  2. Click the Encode button
  3. The Base64 encoded result appears in the Output area
  4. Click to copy the result
🔓 To Decode Base64:
  1. Paste your Base64 string in the Input Text area
  2. Click the Decode button
  3. The decoded text appears in the Output area
  4. Click to copy the result

Base64 Alphabet

The standard Base64 alphabet consists of 64 characters:

A-Z (26) a-z (26) 0-9 (10) + / (2) = (padding)

Note: URL-safe Base64 uses - and _ instead of + and /

Tips & Tricks

  • Padding: Base64 output may end with = or == for padding
  • Size increase: Encoded data is ~33% larger than original
  • Line breaks: Ignore any whitespace when decoding
  • Case sensitive: Base64 is case-sensitive
  • Multiple formats: Some Base64 variants use different characters

Common Issues & Solutions

❌ Decoding Fails

Solution: Ensure the Base64 string doesn't contain spaces, line breaks, or special characters at the start/end. Remove any whitespace and try again.

❌ Invalid Characters

Solution: Base64 only uses A-Z, a-z, 0-9, +, /, and =. Check for invalid characters like spaces or punctuation.

❌ Garbled Output

Solution: If decoding produces garbled text, the Base64 might be for binary data. Try checking if it's an image or other file type.

❌ Length Not Multiple of 4

Solution: Valid Base64 strings should have lengths that are multiples of 4. Add padding (=) if needed.

Advanced Information

Padding Rules:

  • If data length % 3 = 1: Add ==
  • If data length % 3 = 2: Add =
  • If data length % 3 = 0: No padding

RFC 4648 Standard:

This tool uses the standard Base64 encoding defined in RFC 4648, compatible with most applications and systems.

Related Tools

Email Contact Form GitHub LinkedIn