20% OFF Get 20% off Hostinger Web Hosting, Business Email & Marketing bundle! Claim Deal →
News
base64.js READY
// Input
// Result

                
§ Docs What is Base64 Encoding?
Safe Binary-to-Text Transfer
Base64 converts binary data into a set of 64 ASCII printable characters (A-Z, a-z, 0-9, +, and /). This prevents data corruption when transferring files over email (MIME), JSON APIs, URLs, or XML protocols designed only for text.
Encoding, NOT Encryption
Base64 is an encoding format, not cryptographic encryption. Anyone can decode a Base64 string in one click without a secret key. Never use Base64 alone to protect sensitive passwords or credentials.
Reference Base64 vs Base64URL Format Comparison
Feature Standard Base64 (RFC 4648 §4) Base64URL (RFC 4648 §5)
62nd Character + (Plus) - (Hyphen)
63rd Character / (Slash) _ (Underscore)
Padding Character = or == (Required) Omitted or Optional
Size Overhead +33.3% (3 bytes → 4 chars) +33.3% (3 bytes → 4 chars)
Primary Usage MIME emails, HTTP Basic Auth, Data URIs JWT Tokens, URL query parameters, filenames
</> Code How to Encode & Decode Base64 in Code
⚡ JavaScript (Browser & Node.js)
// Browser (ASCII)
const encoded = btoa("Hello World");
const decoded = atob(encoded);

// Node.js (UTF-8 safe)
const b64 = Buffer.from("Hello World").toString("base64");
const txt = Buffer.from(b64, "base64").toString("utf8");
🐍 Python 3
import base64

# Encode
raw = "Hello World".encode("utf-8")
b64 = base64.b64encode(raw).decode("utf-8")

# Decode
orig = base64.b64decode(b64).decode("utf-8")
🐘 PHP
// Encode
$encoded = base64_encode("Hello World");

// Decode
$decoded = base64_decode($encoded);
💻 Bash / Linux CLI
# Encode
echo -n "Hello World" | base64

# Decode
echo -n "SGVsbG8gV29ybGQ=" | base64 -d
? FAQ Frequently Asked Questions
Base64 processes data in 3-byte (24-bit) chunks. If your input is not evenly divisible by 3, padding is added to complete the 4-character block. If 1 byte remains, two = characters are appended. If 2 bytes remain, one = character is appended.
Base64 represents 6 bits of data using an 8-bit ASCII character. Every 3 raw bytes (24 bits) are transformed into 4 Base64 characters (32 bits), leading to an exact ratio of 4/3 or a 33.3% size overhead.
No. The encoder and decoder logic executes 100% in your browser using client-side JavaScript. Your text, tokens, and payloads are never transmitted to any server or recorded in any database.