Base64 Encoder & Decoder
Encode text or files to Base64, decode back, with URL-safe support. Unicode-safe, runs entirely in your browser.
SGVsbG8sIFdSUkshIPCfkYsgRnJlZSwgZmFzdCwgbm8gc2lnbnVwLg==
About this tool
WRRK's Base64 encoder and decoder is a fast, browser-only utility that handles both text and files. It uses the standard TextEncoder /TextDecoder APIs so UTF-8 strings — including emoji, Chinese, Arabic, and accented Latin characters — round-trip without corruption. Toggle URL-safe to switch between the standard alphabet (+ / =) and the URL-safe alphabet (- _ with no padding) commonly seen in JWTs and OAuth.
File mode produces a complete data URI likedata:image/png;base64,…ready to paste into HTML, CSS, or Markdown. Everything runs locally — your data never touches a server, which matters when you're handling auth tokens, customer files, or confidential documents. Engineers use it daily to debug API payloads, inline small assets in HTML emails, and inspect JWT segments.
How to use the Base64 encoder (5 steps)
- Pick mode. Choose Encode (text → base64) or Decode (base64 → text).
- Pick input type. Use Text for plain strings, or File to upload an image, PDF, or document up to 5 MB.
- Toggle URL-safe if needed. Enable URL-safe when working with JWTs, OAuth tokens, or query parameters that require - / _ instead of + / /.
- Read the output. Output appears live as you type. Decode errors are explained inline.
- Copy or download. Click Copy for the clipboard or Download to save the result as a text file.
Use cases
- Inline images in HTML email or CSS using data URIs
- Decode the header or payload segment of a JWT (toggle URL-safe)
- Embed binary files in JSON or XML payloads
- Encode credentials for HTTP Basic Authorization headers
- Pass small binary blobs through query strings safely
- Inspect
Authorization: Basicheaders from API logs - Build OAuth state and PKCE parameters that survive URL encoding
Frequently asked questions
+−What is Base64 encoding?
Base64 represents binary or text data using only 64 ASCII characters (A-Z, a-z, 0-9, +, /, with = padding). It is used to embed images in HTML/CSS, send binary data inside JSON or XML, and pass small payloads through systems that only accept text.
+−Is the data uploaded anywhere?
No. Encoding and decoding happen entirely in your browser using native JavaScript APIs. Your text and files never leave your device — safe for tokens, credentials, and sensitive payloads.
+−What is URL-safe Base64?
Standard Base64 uses + and / which are reserved characters in URLs. URL-safe Base64 replaces them with - and _ and drops the trailing = padding. Toggle 'URL-safe' to encode or decode this variant — common in JWT, OAuth, and HTTP query strings.
+−Why does my decoded text look like garbled characters?
If the original input wasn't UTF-8 text (for example a binary file or a Latin-1 string) it will not display as readable characters. For binary data, use the File tab and download the result as a data URI instead.
+−Does Base64 emoji and Unicode work correctly?
Yes. The tool uses TextEncoder/TextDecoder to handle UTF-8 properly, so emoji, Chinese, Arabic, Devanagari, accented characters, and other multi-byte text encode and decode without corruption.
+−How do I encode an image to Base64?
Switch to the 'File' tab and upload an image. The tool returns a complete data URI like 'data:image/png;base64,iVBOR…' which you can paste directly into HTML <img src=…> or CSS background-image. Max 5 MB to keep it fast.
+−Why do I get an 'Invalid base64' error?
Common causes: extra characters that aren't part of the Base64 alphabet, missing padding, mixing standard and URL-safe variants, or accidentally including a 'data:' prefix. Make sure URL-safe is toggled correctly and remove any 'data:image/...;base64,' prefix.