B64EncodeDecode Logo
B64EncodeDecodePROencoderbase64.com
RFC 4648 Base64URL|Web Worker Powered

Base64URL (RFC 4648) Safe Converter

Encode and decode URL-safe Base64 strings designed specifically for JSON Web Tokens (JWT), URL parameters, and filenames with zero percent-encoding.

0ms Network Latency (100% Client-Side)
Image & Audio Live Visualizer
1-Click Code Snippets (JS, Python, Go, cURL)
Worker Status: Idle / Ready|Overhead: +33.3%
INPUT0 chars • 0 bytes
100% In-Browser
OUTPUT0 chars • 0 bytes

Live Visual Media & Payload Inspector

Auto-Detect

Click to Browse or Drag & Drop Any File

Upload any image (PNG, JPG, SVG, WebP, GIF), audio (MP3, WAV), PDF, or JSON payload to preview and encode instantly.

PNG • JPG • SVG • WebPMP3 • WAV • JSON • PDF100% In-Browser

Developer Code Snippet Generator

Ready-to-use Implementation
// Select an option above to generate code

Technical Specification

How Base64 Encoding Works Under the Hood

Understanding the RFC 4648 binary translation standard and 6-bit pack mechanics.

1The 3-Byte to 4-Character Ratio (+33.3% Overhead)

Base64 takes binary data (8-bit bytes) and converts it into a set of 64 printable ASCII characters. Because 2^6 = 64, each Base64 character represents exactly 6 bits of data. Three 8-bit bytes (24 bits total) are split into four 6-bit groups:

CharacterASCII Code8-Bit Binary6-Bit SplitBase64 DecimalBase64 Output
M7701001101010011 (19)19T
a9701100001010110 (22)22W
n11001101110000101 (5) & 101110 (46)5, 46Fu

Standard Base64 vs URL-Safe Base64URL (RFC 4648)

Standard Base64
  • • Uses characters: + and /
  • • Uses padding: = at the end
  • • Requires percent-encoding inside URLs (%2B, %2F)
Base64URL (Safe for URLs & JWTs)
  • • Replaces + with - (hyphen)
  • • Replaces / with _ (underscore)
  • • Padding (=) is completely omitted

Frequently Asked Questions

Everything You Need to Know About Base64

Quick answers to the most common questions about Base64 encoding, decoding, file sizes, URL safety, and image conversions.

What is Base64?

Base64 is a binary-to-text encoding scheme that converts binary data (such as files, images, or byte arrays) into a sequence of 64 printable ASCII characters (A-Z, a-z, 0-9, +, and /). It is formally defined in IETF specification RFC 4648.

What is Base64 encoding?

Base64 encoding is the process of taking 8-bit binary bytes (or plain text strings) and translating them into 6-bit units. Each 6-bit unit maps to one of 64 standard ASCII characters, ensuring binary data can be safely transmitted over text-only protocols like email (MIME), HTTP headers, and JSON APIs without character corruption.

How does Base64 encoding work?

Base64 takes 3 bytes of binary data (24 bits in total) and splits them into 4 groups of 6 bits each (4 × 6 = 24 bits). Each 6-bit integer (value 0 to 63) corresponds to an ASCII character in the Base64 index table. If the input data is not an exact multiple of 3 bytes, padding characters (=) are added at the end.

How do I encode a string to Base64?

You can encode a string to Base64 instantly online by typing or pasting your text into our free Base64 encoder tool. In JavaScript, use btoa(string); in Python, base64.b64encode(string.encode('utf-8')); and in Linux CLI, echo -n 'text' | base64.

How do I decode a Base64 string?

You can decode a Base64 string back to its original plain text or binary file by pasting the Base64 string into our tool's input box with Auto-Detect or Decode mode enabled. In JavaScript, use atob(base64String); in Python, base64.b64decode(base64String).decode('utf-8'); and in Linux CLI, echo 'base64String' | base64 -d.

What is the difference between Base64 and Base64URL?

Standard Base64 uses '+' and '/' with '=' padding, which require URL encoding (%2B and %2F) when placed in URLs. Base64URL substitutes '+' with '-' and '/' with '_', and removes all '=' padding, making it 100% URL-safe, cookie-safe, and token-safe (JWT) out of the box.

How do I convert an image to Base64?

To convert an image to Base64, simply drag and drop your image file (PNG, JPG, SVG, WebP, or GIF) into our online tool's inspector dropzone. The tool instantly generates a Base64 Data URI in your browser with 1-click buttons to copy the raw string, HTML <img> tag, or CSS snippet.

Is Base64 encryption, and is Base64 secure?

No, Base64 is NOT encryption and provides zero cryptographic security. Base64 is simply an encoding format designed for data transmission compatibility. Anyone who intercepts a Base64 string can decode it back to the original plaintext in milliseconds without a password or key. Never use Base64 alone to protect sensitive passwords or secret keys.