Online Base64 Decoder & Repair Tool
Decode Base64 strings to human-readable text, files, and images. Includes instant syntax validation and 1-click auto-repair for corrupted strings.
Live Visual Media & Payload Inspector
Auto-DetectClick 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.
PDF Document Ready
Base64 PDF stream loaded in memory
Developer Code Snippet Generator
// Select an option above to generate codeTechnical 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:
Standard Base64 vs URL-Safe Base64URL (RFC 4648)
- • Uses characters:
+and/ - • Uses padding:
=at the end - • Requires percent-encoding inside URLs (
%2B,%2F)
- • 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, you can 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 Base64 used for?
Base64 is widely used for: (1) Embedding images and SVG graphics directly in HTML and CSS as Data URIs, (2) HTTP Basic Authentication headers (Authorization: Basic credentials), (3) Email attachments via MIME RFC 2045, (4) Storing cryptographic keys and certificates (PEM format), and (5) Web tokens and APIs (JWT, JSON payloads).
What does Base64 look like?
A Base64 string looks like a continuous alphanumeric string consisting of uppercase letters (A-Z), lowercase letters (a-z), numbers (0-9), plus signs (+), forward slashes (/), and optional equals signs (=) at the end for padding (for example: SGVsbG8gV29ybGQ=).
What is an example of Base64?
An example of Base64 encoding is the text 'Hello World', which encodes to SGVsbG8gV29ybGQ=. Another example is the phrase 'Base64 encode', which encodes to QmFzZTY0IGVuY29kZQ==.
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.
Why does Base64 end with = or ==?
Base64 processes data in 3-byte (24-bit) blocks. If your input data length is not evenly divisible by 3, padding characters (=) are added at the end to ensure the output length is a multiple of 4 characters: 1 byte remaining results in == padding, 2 bytes remaining results in = padding, and 0 bytes remaining requires no padding.
What are valid and invalid Base64 characters?
Valid standard Base64 characters include A-Z, a-z, 0-9, +, /, and = for padding (or - and _ in Base64URL). Any whitespace, punctuation marks like !, @, #, $, %, ^, &, *, (, ), or non-ASCII characters outside this 64-character set are invalid and will trigger decoding errors unless cleaned with an auto-repair tool.
Does Base64 encoding reduce file size?
No, Base64 encoding actually increases file size by approximately 33.3% (ratio of 4/3). Because 3 binary bytes (24 bits) are expanded into 4 ASCII characters (32 bits), the resulting Base64 string is always larger than the original binary data.
What is Base64URL encoding?
Base64URL (RFC 4648 Section 5) is a URL-safe and filename-safe variant of Base64. It replaces the plus sign (+) with a hyphen (-), replaces the forward slash (/) with an underscore (_), and completely omits trailing equals sign (=) padding characters so the string can be safely used in web URLs, query parameters, and JWT tokens without percent-encoding.
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 out of the box.
What is a Base64 image?
A Base64 image is an image file (such as PNG, JPEG, GIF, WebP, or SVG) that has been converted into a Base64-encoded text string and formatted as a Data URI (e.g., data:image/png;base64,iVBORw0KGgo...). This allows the image to be embedded directly into HTML <img src='...'> tags or CSS background-image: url(...) properties without an external image URL.
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 will instantly encode the image into a Base64 Data URI in your browser and provide 1-click buttons to copy the raw Base64 string, HTML <img> tag, or CSS snippet.