Base64 Encode Decode Tool

Online Base64 encoding and decoding, supporting text and Base64 format conversion without data upload

6 Uses | 5.0 Rating

Input Content

Result

Instructions

1

Input Content

Enter the text content to encode or decode in the input box.

2

Select Operation

Click the "Encode to Base64" or "Decode Base64" button to perform the corresponding operation.

3

View Result

View the converted content in the result area.

4

Auxiliary Functions

Use copy, download, swap content and other functions to improve work efficiency.

Base64 Basics

What is Base64?

Base64 is an encoding method that uses 64 printable characters to represent binary data. It is one of the most common encoding methods used on the web to transmit 8-bit bytecode.

The basic principle of Base64 encoding is to encode 3 8-bit bytes (3×8=24 bits) into 4 6-bit bytes (4×6=24 bits), and then map each 6-bit byte to a printable character.

Base64 Application Scenarios

  • Embedding binary data (such as images) in URLs, Cookies, and web pages
  • Transmitting binary attachments in emails (via MIME protocol)
  • Safely transmitting binary data in HTTP environments
  • Transmitting non-ASCII characters in text protocols
  • Encoding authentication information (such as HTTP Basic Authentication)

Base64 Encoding Table

Index Character Index Character Index Character Index Character
0-25 A-Z 26-51 a-z 52-61 0-9 62 +
63 / Padding =

Encoding Process Example

Take the word "Man" as an example to see the Base64 encoding process:

1. Original text: Man

2. ASCII values: 77 97 110

3. Binary: 01001101 01100001 01101110

4. Group by 6 bits: 010011 010110 000101 101110

5. Convert to decimal: 19 22 5 46

6. Look up Base64 table: T W F u

7. Final Base64 encoding: TWFu

URL-Safe Base64

The "+" and "/" characters used in standard Base64 encoding have special meanings in URLs, so URL-safe Base64 encoding variants have emerged:

  • Replace "+" with "-" (minus sign)
  • Replace "/" with "_" (underscore)
  • Optionally remove padding character "="

Advantages and Disadvantages of Base64

Advantages

  • Can convert any binary data to printable characters
  • Encoded data can be safely transmitted in text protocols
  • Most programming languages have built-in Base64 encoding and decoding functions
  • The encoding process is reversible, and the original data can be completely restored

Disadvantages

  • Encoded data size increases by approximately 33%
  • Not an encryption algorithm, cannot be used for data security protection
  • Standard Base64 contains URL special characters and requires additional processing