Free Base64 Encoder / Decoder

Instantly encode any text, URL, or file to Base64 — or decode Base64 strings back to readable text. 100% client-side, secure, and private. Your data never leaves your browser.

🔒 100% Private ⚡ Instant Results 📁 File & Image Support 🔗 URL-Safe Mode 🕐 History Log 🆓 Always Free
Input Text 0 chars
Output 0 chars
Your encoded or decoded result will appear here…

Encode & Decode Base64 in 3 Easy Steps

The fastest, most privacy-focused Base64 tool available online — no sign-up, no limits, no data stored.

1

Paste Your Text or Upload a File

Type or paste plain text to encode, or paste a Base64 string to decode it. Switch to the File tab to upload images, PDFs, or any binary file. Auto-detect mode intelligently identifies whether your input is already Base64-encoded so you get the right operation every time.

2

Choose Your Options and Click Convert

Toggle URL-Safe Mode to produce tokens safe for use in JWTs and query strings. Enable Wrap at 76 chars for MIME-compliant email encoding. Then click Encode to Base64 or Decode from Base64 — results are instant.

3

Copy, Download, or Swap

Copy your result to the clipboard in one click, download it as a .txt file, or click Swap to move the output back into the input and continue processing. For file uploads, copy the complete data: URI for direct HTML/CSS embedding. All operations are saved to the History tab.

The Most Complete Free Base64 Tool

Packed with professional features built for developers, security engineers, and power users

Instant Real-Time Encoding

Results are generated immediately on button click. No page reloads, no server round-trips — everything runs inside your browser using native JavaScript Web APIs for maximum speed.

🔗

URL-Safe Base64 (RFC 4648)

Switch to URL-Safe mode to replace + and / with - and _. Essential for JWT tokens, OAuth authorization codes, PKCE verifiers, and any Base64 used in URLs.

📁

File & Image Encoder

Drag and drop any file — PNG, JPG, GIF, WebP, PDF, MP3, MP4 — to convert it to Base64 instantly. Get the full data: URI for embedding images directly into HTML, CSS, or JavaScript.

🔍

Smart Auto-Detect Mode

Not sure if your input is plain text or Base64? Enable Auto-detect and the tool automatically identifies the format, preventing you from accidentally encoding already-encoded data.

📏

MIME Line Wrapping

Wrap encoded output at 76 characters per line to comply with the MIME standard (RFC 2045). Required for Base64 content in email messages, multipart HTTP requests, and some legacy systems.

🔄

Swap Input / Output

One click sends your output back into the input field for round-trip testing. Verify that encoding followed by decoding returns exactly your original string — critical for debugging data pipelines.

🌐

URL Percent-Encoder

A dedicated URL Encode / Decode tab lets you percent-encode special characters for safe use in query strings, path parameters, and HTTP request bodies — encodeURIComponent precision.

🕐

Conversion History

Your 20 most recent conversions are automatically saved in the History tab. Click any entry to reload the input, making it easy to compare results or re-process previous strings.

📊

Size & Ratio Statistics

See your input length, output length, and the size ratio in real time — so you always know exactly how much overhead the Base64 encoding is adding to your data payload.

🔒

100% Private & Secure

All processing happens entirely inside your browser using btoa(), atob(), and the FileReader API. Zero data is ever transmitted to any server. Works completely offline.

📋

One-Click Copy & Download

Copy results to clipboard instantly or download as a .txt file. For file uploads, copy the raw Base64 or the complete data: URI with a single button click.

📱

Fully Responsive Design

Works flawlessly on desktop, tablet, and mobile. Encode and decode from any device, any browser, anywhere — completely free with no installation or account required.

What Is Base64 Encoding?

A complete guide — how it works, why it exists, standard variants, and when to use it

📖 Definition

Base64 is a binary-to-text encoding scheme that represents binary data using a set of 64 printable ASCII characters. The name derives from that character set: the 26 uppercase letters (A–Z), 26 lowercase letters (a–z), the digits 0–9, plus + and /, with = used as padding.

It was developed to enable binary data — such as images, executable files, and arbitrary byte sequences — to be safely transmitted over systems built only for plain text, like early email infrastructure (SMTP) and HTTP headers.

⚙️ How It Works

Base64 groups input bytes into chunks of 3 (24 bits). Each chunk is split into four 6-bit values, and each 6-bit value maps to one of 64 characters. This means 3 bytes → 4 characters, producing approximately a 33% increase in size.

When input length isn't divisible by 3, = padding fills the remainder: one leftover byte produces two Base64 chars plus ==; two leftover bytes produce three chars plus =.

"Man" → [77, 97, 110] → TWFu
"Ma" → [77, 97] → TWE=
"M" → [77] → TQ==

🔗 Standard vs URL-Safe Base64

Standard Base64 uses + and /, which are reserved characters in URLs. URL-Safe Base64 (RFC 4648 §5) replaces them with - and _, making the output safe in URLs, HTTP headers, cookies, and JSON without percent-encoding.

JWT (JSON Web Tokens), OAuth 2.0 PKCE code challenges, and many modern web APIs exclusively use URL-Safe Base64. Some implementations also omit the = padding. Toggle URL-Safe Mode in our tool to switch between both variants.

📧 MIME Base64 & Line Wrapping

MIME (RFC 2045) specifies that Base64 content in email messages must be wrapped at exactly 76 characters per line, with each line ending in CRLF (\r\n). This ensures compatibility with older mail transfer agents that have line-length limits. Our "Wrap at 76 chars" option produces RFC 2045-compliant output automatically. For use in JSON, HTML, or CSS, always leave wrapping disabled.

When Do You Need Base64?

Base64 is used across dozens of real-world scenarios in web development, APIs, security, and data transport

🖼️ Embedding Images in HTML & CSS

Convert images to data: URIs to embed them directly in HTML or CSS, eliminating extra HTTP requests. Ideal for small icons, loading spinners, and SVG logos bundled inside stylesheets.

🔐 JWT & Authentication Tokens

JSON Web Tokens use URL-Safe Base64 for their header and payload. Decode JWT tokens to inspect user claims, expiry, roles, and custom fields without needing the signing secret.

📧 Email Attachments (MIME)

SMTP email systems encode binary attachments — PDFs, images, spreadsheets — as Base64 so they can pass safely through text-only mail servers. MIME encoding requires 76-char line wrapping.

🌐 REST API Binary Payloads

JSON only supports text. Encode binary files as Base64 before including them in JSON request or response bodies — common in document management APIs, image upload endpoints, and webhook payloads.

🔑 Storing Credentials & Secrets

Store TLS certificates, SSH private keys, and binary API secrets as Base64 strings in environment variables, .env files, and CI/CD pipeline secret stores without corruption.

🛡️ HTTP Basic Auth Headers

HTTP Basic Authentication encodes username:password as Base64 in the Authorization header. Use our tool to quickly generate credentials for curl, Postman, or API testing scripts.

☁️ Kubernetes & Cloud Secrets

Kubernetes Secret resources store all values as Base64-encoded strings. Quickly encode secrets for YAML manifests or decode existing secret values retrieved via kubectl get secret.

🧪 Security Testing & CTFs

Security researchers and CTF players frequently encounter Base64-encoded payloads in cookies, headers, and responses. Decode them instantly to find hidden data, credentials, or obfuscated code.

📄 XML & SOAP Web Services

Legacy SOAP and XML-based web services often transport binary attachments — PDFs, images, signed documents — as Base64-encoded strings within XML element text nodes.

Base64 vs Other Encoding Schemes

Know when to use Base64 and when a different encoding is the better choice

EncodingSize OverheadURL SafeBinary SafeBest For
Base64 (Standard)~33%Email, HTML, REST APIs
Base64 URL-Safe~33%JWT, OAuth, URLs
Hexadecimal~100%Hashes, checksums
URL Encoding (%XX)VariesQuery strings, forms
Plain ASCII0%PartialHuman-readable text only

Who Uses This Tool?

From beginners to senior engineers — our Base64 tool is built for every skill level

👩‍💻

Web Developers

Embed fonts and images in CSS, generate data: URIs, encode API payloads, debug JWT tokens, and test HTTP Basic Auth credentials during development.

🔐

Security Researchers

Decode Base64-encoded payloads in cookies, HTTP headers, JWT tokens, and web app responses during penetration tests, code reviews, and bug bounty hunting.

⚙️

DevOps & SRE Engineers

Encode TLS certificates, SSH keys, and API tokens for Kubernetes Secrets, Terraform configs, GitHub Actions secrets, and Helm chart values.

📧

Email Developers

Test MIME Base64 encoding for HTML email attachments and inline images. Verify RFC 2045 line wrapping without needing to set up a full mail server.

🎓

Students & Learners

Experiment in real time to understand how Base64 works — see padding, character mapping, and size overhead live as you type different inputs.

🧑‍🔬

Data Scientists

Encode model artifacts, binary datasets, and image arrays for transport in REST APIs, message queues, or storage in text-only databases and JSON config files.

Frequently Asked Questions

Everything you need to know about Base64 encoding, decoding, and this free online tool

No. Base64 is purely an encoding scheme, not encryption. It does not add any secrecy — anyone with access to a Base64 decoder can recover the original data instantly. If you need to protect sensitive information, use proper encryption (such as AES-256 or RSA) in addition to or instead of Base64.
Base64 converts every 3 bytes (24 bits) of binary data into 4 ASCII characters. Since each ASCII character is 1 byte, 3 bytes become 4 bytes — a 33.3% overhead. This trade-off makes binary data safe for text-based systems. In practice, HTTP compression (gzip/Brotli) can partially recover this overhead since Base64 output compresses very efficiently.
Standard Base64 uses + and / which have special meanings in URLs. URL-Safe Base64 (RFC 4648 §5) replaces them with - and _ so the output can be used directly in URLs, cookie values, HTTP headers, and JSON strings. Use URL-Safe mode whenever generating JWT tokens, OAuth PKCE codes, or any Base64 value that will appear in a URL.
Completely. All encoding and decoding runs entirely inside your browser using JavaScript's native btoa(), atob(), and the FileReader API. No data — including your text, passwords, JWT tokens, private keys, or uploaded files — is ever sent to any server. The tool also works offline once the page has loaded.
Upload your image in the File / Image tab. Click "Copy as data: URI" to get the full string in the format data:image/png;base64,iVBORw0KGg.... Paste this into an HTML <img src="..."> attribute or a CSS background-image: url(...) property. This is ideal for small icons and logos where eliminating HTTP requests reduces page load time.
A JWT has three dot-separated parts: header.payload.signature. The header and payload are URL-Safe Base64-encoded (without padding). To inspect the payload: copy the second segment, paste it into the input field, enable URL-Safe Mode, and click Decode. You'll see the JSON claims — user ID, expiry, roles, and custom fields. Note: the signature cannot be verified without the signing secret.
Retrieve the Base64-encoded value with kubectl get secret my-secret -o jsonpath='{.data.my-key}', paste the output into our tool, and click Decode from Base64. To encode a secret value for a YAML manifest, type or paste the plaintext value and click Encode to Base64. Always use standard (not URL-Safe) Base64 for Kubernetes secrets.
On Linux/macOS: echo -n "text" | base64 to encode; echo "dGV4dA==" | base64 --decode to decode. For files: base64 input.png > output.txt. On Windows PowerShell: [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("text")). Our online tool is the fastest option when you don't want to open a terminal.

Start Encoding & Decoding Base64 Now

Free, instant, private, and packed with premium features. No account, no limits — just paste and go.