Base64 Converter

📤 Encode
📥 Decode
RESULT

Last updated

Base64 Encoder Decoder

Encode text to Base64 or decode Base64 strings back to text. Base64 is a binary-to-text encoding scheme that represents binary data in ASCII string format using 64 characters.

What is Base64?

Base64 encoding converts binary data into a text format using 64 ASCII characters: A-Z, a-z, 0-9, +, and /. It's commonly used to encode binary data for transmission over text-based protocols.

Common Use Cases

How Base64 Works

Encoding Process:

  1. Convert text to binary (8-bit bytes)
  2. Group binary into 6-bit chunks
  3. Map each 6-bit chunk to Base64 character
  4. Add padding (=) if needed

Example:

Text: "Hello" → Base64: "SGVsbG8="

Common Use Cases Summary

  • HTTP Basic Authentication headers
  • Embedding images and fonts in HTML/CSS as data URLs
  • Transmitting binary data in JSON API payloads
  • Decoding and inspecting JWT token payloads
  • Storing certificates and keys as environment variables
  • Email attachments (MIME encoding)
  • Encoding binary data for storage in text-only databases

All encoding and decoding happens entirely in your browser. Your data is never sent to a server, making it safe to use with sensitive credentials, private keys, and confidential files.

Important Notes

  • Base64 is NOT encryption - it's easily reversible
  • Base64 increases data size by approximately 33%
  • Padding characters (=) are added to make length divisible by 4
  • URL-safe Base64 uses - and _ instead of + and /
  • Never use Base64 alone for security - use proper encryption

Security Warning

⚠️ Base64 is NOT secure!

Base64 encoding is not encryption. Anyone can decode Base64 strings. Never use Base64 to protect sensitive data like passwords or API keys. Use proper encryption (AES, RSA) for security.

Common Applications

  • Embedding images in HTML: <img src="data:image/png;base64,...">
  • HTTP Basic Authentication: Authorization: Basic base64(username:password)
  • JWT tokens: Header and payload are Base64 encoded
  • Email attachments: MIME multipart encoding
  • Storing binary data in JSON/XML

Examples

Example 1: Encoding a String to Base64

The most basic use case is encoding a plain text string. Paste your text into the encoder and get the Base64 output instantly.

Input:  Hello, World!
Output: SGVsbG8sIFdvcmxkIQ==

The == at the end is Base64 padding. It is added automatically to make the output length a multiple of 4. Some systems strip padding — the decoder handles both padded and unpadded input.

Example 2: HTTP Basic Authentication Header

HTTP Basic Auth encodes credentials as Base64 in the Authorization header. The format is username:password encoded to Base64.

Input:  admin:mySecretPassword123
Output: YWRtaW46bXlTZWNyZXRQYXNzd29yZDEyMw==

Authorization header:
Authorization: Basic YWRtaW46bXlTZWNyZXRQYXNzd29yZDEyMw==

Important: Base64 is encoding, not encryption. Anyone who intercepts this header can decode it instantly. Always use HTTPS when sending Basic Auth headers.

Example 3: Embedding an Image as a Data URL

Encode a small image to Base64 to embed it directly in HTML or CSS without a separate file request.

/* CSS with embedded Base64 image */
.logo {
  background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA
  AAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FABJADveRPNEyAAAA
  AElFTkSuQmCC');
}

This technique is useful for small icons and logos where the overhead of an HTTP request outweighs the size increase from Base64 encoding (approximately 33% larger than the original binary).

Frequently Asked Questions

Enter your text in the input field, select 'Encode' mode, and click 'Convert'. The tool will convert your text to Base64 encoding instantly. Base64 encoding converts binary data to ASCII text format using 64 characters (A-Z, a-z, 0-9, +, /).

Paste your Base64 encoded string in the input field, select 'Decode' mode, and click 'Convert'. The tool will decode the Base64 string back to its original text format.

Base64 encoding is used to encode binary data as ASCII text for transmission over text-based protocols like email, JSON, XML, and URLs. Common uses include encoding images in HTML/CSS, API authentication tokens, and data URIs.

No, Base64 is NOT encryption or security. It's simply an encoding format that converts data to text. Anyone can decode Base64 strings. Never use Base64 alone for sensitive data - use proper encryption instead.