Base64 Encoder / Decoder
Encode and decode Base64 strings instantly. Supports text and file input.
What Is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that represents binary data using only 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). It allows any data — text, images, binary files — to be safely transmitted over systems that only handle text, such as HTTP headers, JSON payloads, email bodies, and URLs.
How to Encode or Decode Base64 Online
- Select Encode to convert text → Base64, or Decode to convert Base64 → text.
- Paste your input into the left pane, or click Load Sample.
- Choose Std (standard) or URL (URL-safe) variant.
- For encoding: enable 76-char wrap if you need MIME/PEM line-wrapped output.
- For decoding: enable Auto-fix to strip whitespace and fix missing padding automatically.
- Click Encode or Decode — or turn on Live mode to convert as you type.
- Use ⇄ Swap to instantly flip the input/output and reverse the mode.
- To encode a file, drag it into the File → Base64 panel below the editor, or click to browse.
Standard vs URL-safe Base64
- Standard (Std) — uses
+and/with=padding. Used in email (MIME), PEM certificates, HTTP Basic Auth, and most general-purpose Base64. - URL-safe (URL) — replaces
+with-and/with_, drops padding. Required for JWTs, OAuth tokens, and Base64 embedded directly in URLs.
Common Use Cases
- JWT tokens — the header and payload segments are URL-safe Base64. Switch to URL variant to decode them (or use the JWT Decoder for full token inspection).
- Data URIs — embed images directly in HTML/CSS:
url('data:image/png;base64,...'). Use the File panel to generate data URIs from any image. - HTTP Basic Auth — encodes
username:passwordin standard Base64 for theAuthorizationheader. - Email attachments (MIME) — MIME requires Base64 with 76-character line wraps. Enable 76-char wrap for this format.
- Binary data in JSON APIs — encode binary payloads as Base64 strings to embed them in JSON safely.
Common Base64 Decoding Errors
- Invalid character — the input contains a character outside the Base64 alphabet. Enable Auto-fix which strips whitespace and newlines before decoding.
- Incorrect padding — Base64 strings must be a multiple of 4 characters. Auto-fix adds missing
=padding automatically. - Garbled output — if decoded text looks like gibberish, the input may be URL-safe Base64 (
-and_instead of+and/). Switch to URL variant. - Binary output — decoding a file's Base64 produces binary data that won't display correctly as text. Use the browser's native tools or download the output instead.
How Much Does Base64 Increase File Size?
Base64 encoding increases data size by approximately 33% — every 3 bytes of input become 4 Base64 characters. With 76-character line wraps (MIME), the overhead is slightly higher due to the added newlines. The stats badge on this tool tracks the exact input vs output byte count for every conversion.
Related Tools
- JWT Decoder — inspect Base64-encoded JWT header and payload
- URL Encoder / Decoder — percent-encode special characters for URLs
- Hash Generator — generate MD5, SHA-256, and other hashes
Is My Data Sent to a Server?
No — all encoding, decoding, and file processing run entirely in your browser using native Web APIs (btoa, atob, FileReader). Your text and files never leave your machine.