Base64 Encode Decode

Encode text to Base64 or decode Base64 back to readable text for APIs, auth headers and data URIs.

Back to all tools on ToolForge

More in Encoding & Decoding





Result

About Base64 Encode Decode

This Base64 encoder/decoder converts text to Base64 and decodes Base64 strings back to readable text entirely in your browser. No data is sent to any server, making it safe for encoding sensitive API responses, configuration data, or debugging authentication headers.

How Base64 Encoding Works

Base64 encoding transforms binary data into ASCII text by:

  1. Grouping input bytes into sets of 3 (24 bits total)
  2. Splitting each group into 4 chunks of 6 bits
  3. Mapping each 6-bit value (0-63) to a character from the Base64 alphabet
  4. Adding = padding if the input length is not divisible by 3

Base64 Character Set

The standard Base64 alphabet uses 64 characters:

Common Base64 Use Cases

Example: Encoding "Hello"

Step Data
Original text Hello
ASCII bytes 72 101 108 108 111
Binary 01001000 01100101 01101100 01101100 01101111
Regrouped (6-bit) 010010 000110 010101 101100 011011 000110 1111
Base64 indices 18 6 21 44 27 6 60
Base64 output SGVsbG8=

Important: Base64 Is Not Encryption

Base64 encoding provides no security. Anyone can decode a Base64 string to recover the original data. Use encryption (like AES) if you need to protect sensitive information.

How to Encode or Decode Base64

  1. Choose mode: Select "Text to Base64" for encoding, or "Base64 to Text" for decoding.
  2. Enter your data: Type or paste your text (for encoding) or Base64 string (for decoding) into the input box.
  3. Click Convert: The tool will process your input and display the result in the output box.
  4. Copy the result: Click "Copy Result" to copy the converted value to your clipboard.
  5. Swap if needed: Use the "Swap" button to quickly switch between encode and decode modes.

Example Conversions

Encode example:

Decode example:

Frequently Asked Questions

What is Base64 encoding and how does it work?
Base64 is a binary-to-text encoding scheme that represents binary data in ASCII string format. It works by grouping every 3 bytes (24 bits) of input data into 4 groups of 6 bits each, then mapping each 6-bit group to one of 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). If the input length is not divisible by 3, padding characters (=) are added.
Is Base64 encryption? Can I use it to hide secrets?
No. Base64 is encoding, not encryption. Anyone can decode a Base64 string back to the original data. Never use Base64 to hide passwords, API keys, or sensitive information. For secure encoding, use encryption algorithms like AES first, then optionally encode the encrypted output with Base64.
Why does my Base64 string contain invalid characters?
Valid Base64 characters are A-Z, a-z, 0-9, +, /, and = for padding. If you see other characters, the string may be URL-encoded Base64 (which uses - and _ instead of + and /) or corrupted. This tool handles standard Base64. For URL-safe Base64, replace + with - and / with _.
What are common use cases for Base64?
Common uses include: embedding images in HTML/CSS (data URIs), encoding binary data in JSON/XML APIs, storing complex data in cookies or localStorage, email attachments (MIME), and representing cryptographic keys or certificates in text format.