Base64 Encoder / Decoder
Drag & drop a file here, or click to upload
Usage Guide
Base64 Encoder / Decoder is a browser-based utility for converting text and binary data to and from Base64 encoding — a widely-used format that represents binary data using only printable ASCII characters. Base64 is everywhere in modern software: email attachments use it to encode binary content, web pages use data: URIs to embed images and fonts inline, HTTP Basic Authentication encodes credentials in Base64, JSON Web Tokens (JWTs) store their header and payload as Base64url strings, and configuration files often embed binary blobs as Base64. This tool supports both standard Base64 (RFC 4648) and Base64url (URL-safe variant that replaces + with - and / with _), making it suitable for a wide range of use cases. You can encode plain text, Unicode strings, JSON documents, or binary file contents; equally, you can decode any Base64 string back to its original form. The file mode lets you drag in any binary file — images, PDFs, archives — and produces the Base64 string that can be embedded directly in an HTML img src attribute or a data URI. All operations are instant and entirely local: nothing is transmitted anywhere, so you can safely encode sensitive credentials, private keys, or confidential documents.
- Select encode or decode mode — Use the mode toggle at the top to switch between "Encode" (text or file → Base64) and "Decode" (Base64 → text or file). The panels update automatically.
- Enter text to encode — In Encode mode, type or paste any text — plain ASCII, Unicode, JSON, XML, or any string — into the left input panel. The Base64 output appears instantly in the right panel as you type.
- Encode a binary file — Drag and drop any file (image, PDF, ZIP, etc.) onto the file-drop zone. The tool reads the file locally and produces the complete Base64 string in the output panel, ready to embed in a data URI.
- Decode a Base64 string — Switch to Decode mode and paste a Base64 or Base64url string into the input panel. The decoded text appears immediately. If the original data was binary (e.g. an image), a download link is provided.
- Choose standard or URL-safe — Toggle between standard Base64 (uses + and /) and Base64url (uses - and _, safe for URLs and JWT). Most JWTs and OAuth tokens use Base64url.
- Copy or download the result — Click "Copy" to copy the encoded or decoded output to your clipboard, or "Download" to save it as a file. For decoded binary content, the download preserves the original binary format.
Frequently Asked Questions
What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). It is commonly used to embed binary data — such as images or files — inside text-based formats like JSON, HTML, or email.
Is my data sent to a server when I encode or decode it?
No. All encoding and decoding happens entirely in your browser using the native JavaScript btoa() / atob() and FileReader APIs. Nothing is uploaded to any server.
Can I encode files to Base64?
Yes. Switch to File mode, then drag and drop or select any file. The tool reads it with the FileReader API and outputs the full Base64 data URI, which you can copy and use directly in CSS (background-image), HTML (src attribute), or JSON payloads.
Can I use this tool offline?
2Kit is a Progressive Web App (PWA). After your first visit it is cached by the service worker and works completely offline.
What is the difference between Base64 and URL-safe Base64?
Standard Base64 uses + and / characters which have special meaning in URLs. URL-safe Base64 replaces them with - and _ respectively, making the encoded string safe to include in a URL query string without percent-encoding.
Technical Implementation
All processing runs entirely in your browser — no data is ever sent to any server. This tool works fully offline as a Progressive Web App (PWA): after the first visit, all pages and assets are cached by a Service Worker and remain available without an internet connection. Your input data never leaves your device, making it safe for sensitive content including API keys, passwords, private configuration, and confidential documents.