Home/Tools/Base64 Encoder Decoder

Base64 Encoder Decoder

Free online tool to encode and decode Base64 strings. Convert text and files to multiple formats including hex, binary, Base32, and more.

0 characters
0 characters

Privacy: All encoding and decoding happens entirely in your browser. No data is sent to any server.

Key Features

🔄

Encode & Decode

Quickly encode text to Base64 or decode Base64 strings back to readable text. Switch between modes with a single click.

📁

File Support

Encode files up to 10MB directly to Base64. Drag and drop or click to upload. Perfect for creating data URIs for images.

🎯

Multiple Formats

Get instant conversions to 8 different formats: Base64, Base64 URL-safe, hex, binary, ASCII, URL encoding, Base32, and Unicode.

🔍

Auto-Detection

In decode mode, automatically detects the input format (Base64, hex, binary, etc.) and converts it correctly.

🔐

100% Private

All encoding and decoding happens in your browser. Your data never leaves your device - nothing is sent to servers.

Fast & Easy

Copy any format with one click, download results, or use the try sample button to see the tool in action instantly.

Understanding Base64 Encoding

Base64 is a method of encoding binary data as text using a specific set of 64 ASCII characters. It is widely used in web development, email systems, and data transmission.

How It Works

Base64 encoding converts data in three steps:

  1. Divide the input data into groups of 3 bytes (24 bits)
  2. Split each 24-bit group into four 6-bit segments
  3. Convert each 6-bit value (0-63) to a Base64 character

Padding characters (=) are added if the input length is not divisible by 3.

Character Set

Base64 uses 64 specific characters:

  • • A-Z (uppercase letters, values 0-25)
  • • a-z (lowercase letters, values 26-51)
  • • 0-9 (digits, values 52-61)
  • • + (plus sign, value 62)
  • • / (forward slash, value 63)
  • • = (padding character)

Common Use Cases

  • • Embedding images in HTML/CSS (data URIs)
  • • Email attachments (MIME encoding)
  • • JSON Web Tokens (JWT)
  • • API authentication (Basic Auth)
  • • Storing binary data in text databases
  • • URL parameters and cookies

Advantages & Limitations

Advantages:

  • • Text-safe for any transmission medium
  • • Human-readable (can be copied/pasted)
  • • Widely supported across platforms

Limitations:

  • • Increases data size by ~33%
  • • Not suitable for large files in memory
  • • Not encryption (easily decoded)

Supported Encoding Formats

Base64 Standard

Uses A-Z, a-z, 0-9, +, / characters with = padding. The most common encoding format.

Text:
Hello, World!
Base64:
SGVsbG8sIFdvcmxkIQ==

Base64 URL-Safe

Replaces + with -, / with _, and removes padding. Safe for URLs and filenames without encoding.

Text:
Hello, World!
Base64 URL-Safe:
SGVsbG8sIFdvcmxkIQ

Hexadecimal

Each byte represented as two hexadecimal digits (0-9, A-F). Commonly used in color codes and low-level programming.

Text:
Hi
Hex:
48 69

Binary

Each byte represented as eight binary digits (0 or 1). Shows the raw binary representation of data.

Text:
Hi
Binary:
01001000 01101001

Base32

Uses A-Z and 2-7 characters. More human-readable than Base64, commonly used in TOTP authentication codes.

Text:
Hello
Base32:
JBSWY3DPEQ======

Practical Examples

1. Embedding Images in HTML

Encode an image to Base64 and embed it directly in your HTML using a data URI:

<img src="data:image/png;base64,iVBORw0KG..." alt="Logo" />

Benefits: No separate HTTP request, works offline, useful for small images and icons.

2. HTTP Basic Authentication

Username and password are combined with a colon and Base64 encoded:

// username:password
admin:secret123
// Base64 encoded
YWRtaW46c2VjcmV0MTIz
// Authorization header
Authorization: Basic YWRtaW46c2VjcmV0MTIz

3. JSON Web Tokens (JWT)

JWTs use Base64 URL-safe encoding for header and payload:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIn0.
SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c

Each section (header.payload.signature) is Base64 URL-safe encoded JSON.

Frequently Asked Questions

Find answers to common questions

Base64 is a binary-to-text encoding scheme that converts binary data into ASCII text format using a set of 64 characters (A-Z, a-z, 0-9, +, /). It is commonly used to encode data that needs to be stored or transmitted over media designed for text, such as email attachments, data URLs, and JSON web tokens.

Need Developer Tools for Your Team?

We offer custom developer tools, API development, and technical consulting services for businesses of all sizes.