Developer Tools
Base64 Encode & Decode
Encode and decode Base64 text, files, and images. File-to-Base64 and Base64-to-file conversion, URL-safe mode, MIME detection, line-by-line batch mode, size comparison, Base32/Hex/ASCII85 variants. Free, private.
Free Base64 Encode & Decode Online — Text, Image & File Converter
What Is Base64 Encoding?
Base64 encoding is a binary-to-text encoding method that converts any data — text, images, files, binary — into a string of 64 safe ASCII characters (A-Z, a-z, 0-9, +, /). It is one of the most widely used encoding schemes in computing, powering everything from email attachments (MIME encoding) to data URIs in HTML/CSS, Kubernetes secrets, JWT tokens, HTTP Basic Authentication, and API payload encoding.
Our free Base64 encoder and decoder handles both text and files in both directions: encode text/files to Base64, and decode Base64 back to text or downloadable files. It runs 100% in your browser — your data never touches our servers. Unlike basic tools like base64decode.org that only handle text, our tool includes file encode and decode, MIME type detection, image preview, URL-safe mode, line-by-line batch processing, and 4 encoding variants (Base64, Base32, Hex, ASCII85).
How to Encode Text to Base64
Click the "Encode" tab at the top. Type or paste your plain text into the left input area. The Base64 encoded output appears instantly in the right panel — no button click needed. The output updates in real time as you type. You will see a live size comparison bar showing the original size vs encoded size (typically ~33% larger). Click "Copy Output" to copy the Base64 string to your clipboard.
Options available while encoding:
- URL-safe Base64 — toggle to replace + with - and / with _ (RFC 4648 Base64URL format, used in JWTs and URLs)
- Character set — choose UTF-8 (default), ASCII, or ISO-8859-1 for how input text bytes are encoded
- Encoding variant — switch between Base64, Base32, Hex, or ASCII85 output formats
How to Decode Base64 to Text
Click the "Decode" tab. Paste your Base64 string into the left input area. The decoded text appears instantly in the right panel. If the decoded content is JSON, the tool auto-detects it and shows pretty-printed formatted output. If the Base64 string represents an image (PNG, JPEG, GIF, SVG, WebP), a visual preview appears automatically below the output. A MIME type badge shows what type of data was detected (e.g., "PNG Image", "JSON Data", "Plain Text").
How to Convert a File to Base64
Scroll to the "File Encode / Decode" section. Click the "Encode File" tab. Drag and drop any file onto the upload area, or click to browse. The tool accepts images (PNG, JPEG, GIF, SVG, WebP), PDFs, documents, and any binary file up to 10MB. The tool generates a complete data URI with the correct MIME type prefix (e.g., data:image/png;base64,iVBOR...). You get two copy options: "Copy Data URI" for the full string ready for HTML/CSS embedding, or "Copy Base64 Only" for just the encoded data without the MIME prefix. For images, a preview thumbnail is shown.
How to Decode Base64 Back to a File
In the "File Encode / Decode" section, click the "Decode to File" tab. Paste a Base64 string or complete data URI into the textarea. The tool auto-detects the MIME type from the data header bytes — it recognizes PNG, JPEG, GIF, WebP, SVG, PDF, ZIP, HTML, XML, JSON, and plain text. The decoded file size is displayed. If the data is an image, a visual preview appears. Click "Download File" to save the decoded file with the correct extension (e.g., .png, .pdf, .json).
How to Use Line-by-Line Batch Mode
Toggle the "Line by Line" switch to process each line of your input independently. In encode mode, each line is Base64-encoded separately. In decode mode, each line is decoded separately. Results display in a clean table with line number, input text, and output. This is useful for batch encoding passwords, processing CSV data, encoding multiple API keys, or decoding multiple Base64 strings at once without re-entering each one.
All Features
- Real-time encode and decode — output updates instantly as you type, no submit button needed
- File to Base64 encode — drag-drop any file up to 10MB, generates data URI with MIME type
- Base64 to file decode — paste Base64, auto-detect MIME, preview images, download with correct extension
- URL-safe Base64 — RFC 4648 Base64URL format for URLs, JWTs, and filenames
- 4 encoding variants — Base64, Base32, Hex, ASCII85
- Line-by-line batch mode — process each line independently, table view
- MIME type detection — auto-detects PNG, JPEG, PDF, JSON, and 15+ types from header bytes
- Image preview — visual preview when decoding Base64 images
- JSON auto-formatting — pretty-prints decoded JSON
- Character set selector — UTF-8, ASCII, ISO-8859-1
- Live size comparison — visual bar showing encode overhead percentage
- Swap button — move output to input for round-trip testing
- Share via URL — encode small payloads in a shareable link
- Operation history — last 10 operations saved locally
- 100% client-side — zero server requests, complete privacy
Why Choose Our Base64 Tool?
Unlike base64decode.org (text only, no file decode, no batch mode), base64encode.org (no MIME detection, no image preview), and base64.sh (requires API key for advanced features), our free online Base64 encoder decoder combines every feature developers need:
- Bidirectional file support — encode files TO Base64 AND decode Base64 BACK to files (most tools only do one direction)
- MIME auto-detection — recognizes 15+ file types from header bytes
- Batch line-by-line — unique feature for processing multiple strings
- 4 encoding formats — Base64, Base32, Hex, ASCII85 in one tool
- Zero data collection — everything runs in your browser
Common Use Cases
- Embed images in HTML/CSS — convert small images to Base64 data URIs to reduce HTTP requests
- Kubernetes secrets — encode and decode
kubectl create secretvalues - JWT inspection — decode the payload section of JSON Web Tokens
- API development — encode/decode request payloads, Basic Auth headers, and webhook bodies
- Email attachments — decode MIME-encoded email attachments
- DevOps CI/CD — encode secrets for GitHub Actions, Docker, and deployment configs
- Data migration — encode binary data for storage in JSON or XML
- File recovery — decode Base64 strings from logs or databases back into original files
Tips & Best Practices
Use URL-safe Base64 whenever the encoded string will appear in a URL, query parameter, or filename — standard +/ characters break URLs. Keep inline images small — Base64 data URIs add 33% size overhead and bypass browser caching, so only embed images under 5KB. For Kubernetes, use echo -n "value" | base64 (the -n flag prevents encoding a trailing newline). For JWT debugging, decode only the middle section (between the dots) — the header and payload are Base64URL encoded, the signature is binary. Use batch mode for encoding multiple values — paste one per line instead of encoding each individually. Use the swap button to verify round-trip integrity — encode, then swap output to input and decode to confirm the original text is recovered.