Base64 Encode/Decode

Function Description

🔤 Text Encoding

Convert plain text to Base64 encoding format

🔓 Text Decoding

Convert Base64 encoding back to original text content

🔄 Bidirectional Conversion

Support bidirectional encoding and decoding operations

🔒 Local Processing

All operations are performed locally to protect data security

Usage Steps

  1. Input Text: Enter the text to be encoded or Base64 encoding in the left input box
  2. Select Operation: Click "Encode → Base64" to encode, or "Decode ← Base64" to decode
  3. View Results: Check the conversion results in the right output box
  4. Copy Results: Use the "Copy Output" button to copy results to clipboard

Case Examples

📝 Simple Text Encoding

Original: Hello World
Base64: SGVsbG8gV29ybGQ=

🌐 URL Encoding

Original: https://example.com
Base64: aHR0cHM6Ly9leGFtcGxlLmNvbQ==

🔢 Number Encoding

Original: 123456789
Base64: MTIzNDU2Nzg5

🎨 Special Characters

Original: !@#$%^&*()
Base64: IUAjJCVeJiooKQ==

Application Scenarios

📧

Email Transmission

Transmit binary data in emails

🌐

Web Embedding

Embed images in HTML/CSS

🔐

Data Storage

Store binary data in databases

🔧

API Transmission

Transmit binary data via JSON

📝 Input Text
Length: 0
📄 Output Result
Length: 0

🔍 Base64 Working Principle

  • Grouping: Every 3 bytes (24 bits) are divided into 4 groups of 6 bits each
  • Character Mapping: Each 6-bit value maps to one character from A-Z, a-z, 0-9, +, /
  • Padding: If input length is not a multiple of 3, pad with 0 bits and add = or ==
  • Text Safety: Base64 is used to transmit binary data over text channels, not encryption

Detailed Description

📊 Encoding Process

  1. Convert input text to byte array
  2. Group every 3 bytes (24 bits)
  3. Divide each group into 4 segments of 6 bits
  4. Map each 6-bit segment to Base64 character
  5. Pad with = when less than 3 bytes

🔤 Character Table

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

Notes

  • Not Encryption: Base64 is an encoding method, not an encryption algorithm, data is fully visible
  • Size Increase: Encoded data is approximately 33% larger than original data
  • Character Limit: Only uses ASCII characters, suitable for text transmission
  • URL Safety: Standard Base64 contains + and / characters, needs escaping in URLs
  • Padding Characters: = characters are only used for padding, do not affect decoding results