Base64 Encoder & Decoder
Encode text or binary files to Base64, or decode Base64 strings back to their original format. Supports file uploads for images, PDFs, and other binary data.
What is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format using a set of 64 characters (AβZ, aβz, 0β9, +, and /). It is widely used across the web for embedding images directly into HTML or CSS, transmitting binary data through text-based protocols like email (MIME) and JSON APIs, and storing complex data in text-only formats such as XML and YAML.
The name "Base64" comes from the fact that each character in the encoded string represents exactly 6 bits of the original data (26 = 64 possible values). Three bytes (24 bits) of binary data are split into four 6-bit groups, each mapped to a Base64 character. If the input isn't a multiple of 3 bytes, padding characters (=) are added to the end.
Why Use This Base64 Tool?
Our Base64 Encoder/Decoder runs entirely in your browser β your data never leaves your computer. It handles both text and binary files, making it ideal for developers who need to:
- Embed images in HTML/CSS: Convert PNG, JPEG, or SVG files to Base64 data URIs for inline embedding, reducing HTTP requests.
- Transfer files via JSON APIs: Encode PDFs, documents, or images as Base64 strings to include them in JSON payloads.
- Encode credentials: Base64-encode username:password pairs for HTTP Basic Authentication headers.
- Debug encoded data: Decode Base64 strings from API responses, logs, or configuration files to inspect the original content.
- Data URI generation: Create ready-to-use
data:image/png;base64,β¦URIs for web development.
Encoding Text vs. Binary Files
For text encoding, the tool uses JavaScript's built-in btoa() function, which converts a string to its Base64 representation. This works for plain text, JSON, XML, and any other text-based content. Simply type or paste your text into the input box and click Encode.
For binary files (images, PDFs, zip archives, etc.), use the file upload button. The file is read using the browser's FileReader API as a binary string, then encoded to Base64. After encoding, you can copy the full Base64 string or download it as a .txt file. For images, the tool can optionally generate a complete data URI that you can paste directly into an <img> tag's src attribute.
Decoding Base64 Strings
Switch to Decode mode to convert a Base64 string back to its original form. The tool uses atob() for decoding. If the decoded result is valid UTF-8 text, it will be displayed directly in the output area. For binary data, you can download the decoded bytes as a file. The tool automatically detects whether the decoded content is text or binary and presents the appropriate output format.
Keyboard Shortcuts
For faster workflow, press Ctrl+Enter (or Cmd+Enter on Mac) while the input field is focused to trigger the current mode's primary action β encoding in Encode mode or decoding in Decode mode. This saves you from reaching for the mouse and speeds up batch processing.
Is Base64 Encryption?
No. Base64 is encoding, not encryption. It provides no security whatsoever β anyone can decode a Base64 string back to its original form instantly. Base64 is purely a data representation format designed to ensure binary data can be safely transmitted through systems that only support text. If you need to protect sensitive data, use proper encryption algorithms such as AES-256 or RSA. Never rely on Base64 encoding for security.
π‘ Pro Tips
- Data URIs for one-off images: Upload a small icon or logo, encode it, and paste the resulting
data:image/png;base64,β¦URI directly into your HTML or CSS. No separate image file needed β great for email signatures and single-page demos. - Decode JWT payloads instantly: A JSON Web Token's payload is just Base64. Copy the middle segment (between the two dots), paste it into Decode mode, and you'll see the claims in plain text β no library needed.
- Spot the difference between Base64 and Base64URL: If your Base64 string has
-and_instead of+and/, it's Base64URL (used in JWTs and URL-safe contexts). Replace-β+and_β/before decoding.
Can I Encode Large Files?
Yes β this tool processes files entirely in your browser's memory using the FileReader API. For most use cases (images under 10 MB, documents, small archives), performance is instant. Very large files (50 MB+) may cause brief browser lag since the entire file must be read into RAM for encoding. If you're working with large binaries regularly, consider a native command-line tool like base64 on Linux/macOS or certutil -encode on Windows. For everyday developer tasks β embedding icons, encoding API credentials, or inspecting JWT payloads β the browser-based tool is more than sufficient.
How to Use This Tool
Using the Base64 tool is simple. For encoding: type or paste your text, or upload a file, then click Encode (or press Ctrl+Enter). The Base64 output appears below, ready to copy or download. For decoding: switch to Decode mode, paste a Base64 string, and click Decode. The tool handles both padded and unpadded Base64 strings automatically.