Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 strings back to plain text online. Free Base64 encoder decoder tool for developers and data analysts.
How to Use Base64 Encoder / Decoder
- 1Paste your plain text or Base64 string into the Input panel.
- 2Click Encode to Base64 to convert plain text to Base64 format.
- 3Click Decode from Base64 to convert a Base64 string back to plain text.
- 4Enable Auto-detect mode and click Auto Convert to let the tool choose encode or decode automatically.
- 5Use the ⇅ Swap button to move the output back to input for further conversion.
About Base64 Encoder / Decoder
The Base64 Encoder/Decoder tool allows you to instantly encode any plain text or binary data to Base64 format, or decode Base64-encoded strings back to their original text. It supports standard and URL-safe Base64 alphabets and is commonly used for encoding authentication credentials, embedding images in HTML/CSS, and handling binary data in APIs and data URIs.
How Base64 Encoder / Decoder Works
Base64 is a binary-to-text encoding scheme that represents binary data using a set of 64 printable ASCII characters. It was defined in RFC 4648 and is used whenever binary data needs to be stored or transmitted over a medium that is designed to handle text. The 64 characters used are A–Z (uppercase), a–z (lowercase), 0–9 (digits), plus (+) and forward slash (/), with equals (=) used as padding. The encoding process takes each 3 bytes of binary data and converts them into 4 Base64 characters — the 24 bits are split into four 6-bit groups, each mapped to one Base64 character. If the input is not a multiple of 3 bytes, one or two padding = characters are appended. This is why Base64-encoded strings are always a multiple of 4 characters and are about 33% larger than the original data. Our tool uses the browser's native btoa() and atob() functions, which are the same APIs used by web browsers for data URIs and authentication headers, ensuring fully compatible output.
Output length = ⌈(input bytes ÷ 3)⌉ × 4
Overhead ≈ 33% larger than originalExample: encoding the word "Hello"
- "Hello" in ASCII bytes: 72 101 108 108 111
- Split into 3-byte groups: [72, 101, 108] and [108, 111]
- Group 1 (24 bits: 010010 000110 010100 011100) → S G V s → "SGVs"
- Group 2 with padding (16 bits + 2 bits padding) → b G 8 = → "bG8="
"Hello" → "SGVsbG8="
Reference Data
Common Uses of Base64 Encoding
| Use Case | Where It Appears | Example Format |
|---|---|---|
| HTTP Basic Auth | Authorization header | Basic dXNlcjpwYXNz |
| Data URIs in HTML/CSS | src and url() attributes | data:image/png;base64,iVBOR... |
| Email attachments (MIME) | Content-Transfer-Encoding | Base64 block in .eml file |
| JSON Web Tokens (JWT) | Header.Payload.Signature | eyJhbGciOiJIUzI1NiJ9... |
| XML / SOAP data | XML element value | <data>SGVsbG8=</data> |
| Binary in environment vars | CI/CD secret storage | BASE64_ENCODED_CERT=... |
| URL-safe Base64 | OAuth tokens, file names | +/ replaced with -_ no padding |
Who Uses This Tool and Why
- ✓Developers encode API credentials (username:password) to Base64 for HTTP Basic Authentication headers when building or testing REST APIs.
- ✓Frontend developers embed small images directly into CSS or HTML as data URIs to eliminate HTTP round-trips for critical above-the-fold resources.
- ✓DevOps engineers store TLS certificates, private keys, and other binary secrets in environment variables (which are text-only) by encoding them to Base64.
- ✓Data analysts decode Base64 payloads from webhook events or API logs to inspect the actual binary content that was transmitted.
- ✓Security researchers decode JWT (JSON Web Token) payloads to inspect claims and understand token structure when auditing authentication systems.
Limitations & Practical Tips
Known Limitations
- •Base64 is an encoding, not encryption. Anyone with a Base64 decoder (including this tool) can decode your data instantly. Never use Base64 to protect sensitive information.
- •Base64-encoded data is about 33% larger than the original binary — this overhead makes it unsuitable for large files like video or high-resolution images.
- •Standard Base64 uses + and / which are not URL-safe. If you need to embed Base64 in a URL, use URL-safe Base64 (RFC 4648 §5) which replaces + with - and / with _.
- •Not all text editors and terminals handle Base64 strings well — very long Base64 strings (from large files) may be line-wrapped at 76 or 80 characters, which breaks decoding unless the newlines are stripped first.
Tips for Best Results
- →When decoding Base64 you received from an external source, check whether it uses standard or URL-safe alphabet — if decoding fails, try swapping - back to + and _ back to /.
- →JWT tokens are Base64url-encoded (no padding) — if you paste one in, it should decode cleanly. The payload section (between the two dots) contains the claims as JSON.
- →For debugging HTTP Basic Auth issues, encode "username:password" (colon-separated, no spaces) and compare to the Authorization header value sent by your HTTP client.
Frequently Asked Questions
- What is Base64 encoding used for?
Base64 encodes binary data as ASCII text, making it safe to transmit over text-based protocols. Common uses include encoding images in CSS data URIs, HTTP Basic Auth headers, and email attachments.
- How do I decode a Base64 string?
Paste the Base64 string into the input panel and click "Decode from Base64". The decoded plain text will appear in the output panel immediately.
- Does Base64 encoding encrypt my data?
No. Base64 is an encoding scheme, not encryption. Encoded strings can be decoded by anyone with the right tool. Do not use Base64 to protect sensitive information.
- Why does Base64 use the = sign at the end?
The = characters are padding. Base64 encodes 3 bytes at a time into 4 characters. If the input is not a multiple of 3 bytes, one or two = signs are appended to make the output a multiple of 4 characters. Two = signs means 1 byte of padding; one = sign means 2 bytes of padding.
- What is URL-safe Base64?
Standard Base64 uses + and / which are special characters in URLs. URL-safe Base64 (defined in RFC 4648 §5) replaces + with - (hyphen) and / with _ (underscore), and often omits padding = signs. It is used in JWT tokens, OAuth codes, and URL parameters.
- How much larger does Base64 make my data?
Base64 output is always approximately 33% larger than the input. Every 3 bytes of binary data become 4 characters of Base64. A 300 KB image becomes roughly 400 KB as a Base64 string, which is why Base64 data URIs should only be used for small images.
- How do I decode a JWT token?
A JWT consists of three Base64url-encoded parts separated by dots: header.payload.signature. To read the claims, copy the middle part (between the two dots) and decode it with this tool. The result is a JSON object containing user data and token metadata. Never share the full JWT or trust decoded claims without verifying the signature.
Looking for more tools like this? Browse all Developer Tools →
More Developer Tools
JSON Formatter
Format, validate, and minify JSON online. Instantly beautify or compress JSON data with syntax highlighting. Free JSON formatter and validator.
URL Encoder / Decoder
Encode or decode URLs and query strings online. Convert special characters to percent-encoding instantly. Free URL encoder decoder for developers.
Password Generator
Generate strong, random passwords instantly. Customize length and character types. Free secure password generator tool for safe online accounts.
Color Converter
Convert colors between HEX, RGB, HSL, and HSB online free. Pick colors visually and copy CSS values in any format instantly — no signup needed.
Unix Timestamp Converter
Convert Unix timestamps to human-readable dates and times online free. Convert dates to Unix timestamps in seconds or milliseconds instantly.
Regex Tester
Test and debug regular expressions online free. Write regex patterns, test against sample text, and see matches highlighted instantly.
You Might Also Like
Word Counter
Count words, characters, sentences, and paragraphs instantly. Free online word counter tool with reading time estimate for writers and students.
Character Counter
Count characters with and without spaces instantly. Free online character counter for Twitter, Instagram, SMS, and meta tag length limits.
Percentage Calculator
Calculate percentages, percentage change, and what percent one number is of another. Free online percentage calculator for everyday math.
Last updated: May 2, 2026 — Base64 Encoder / Decoder by CalcDash.