Base64 Encoder / Decoder
Encode plain text to Base64 or decode Base64 strings back to text instantly. Supports Standard and URL-safe variants, MIME 76 line wrapping, padding control, and multiple character sets. Runs entirely in your browser.
The selected charset applies to both encoding (text โ bytes โ Base64) and decoding (Base64 โ bytes โ text). Shift_JIS and GBK encoding tables are built on first use; there may be a brief pause.
How to encode text to Base64
- Select Encode mode (default).
- Type or paste your plain text into the input area.
- Choose the variant: Standard (uses +, /, =) or URL-safe (uses -, _, no padding).
- Click Convert or press Ctrl/Cmd + Enter.
- Copy the Base64 output with the copy button or Ctrl/Cmd + Shift + C.
How to decode a Base64 string
- Select Decode mode.
- Paste your Base64 string. The tool auto-detects Standard vs. URL-safe variants.
- Whitespace and line breaks are stripped by default. Switch to Strict if you want exact validation.
- Click Convert or press Ctrl/Cmd + Enter.
- Read the decoded text in the output pane.
How to inspect a JWT safely
- Switch to Decode mode.
- Paste the JWT token. It has three dot-separated parts: header.payload.signature.
- The tool auto-detects the JWT shape and decodes the header segment as Base64url.
- To inspect the payload, paste just the payload segment and decode it again.
- Your token never leaves your browser - no server sees it.
How to embed a Base64 data URI in HTML or CSS
- Encode the source bytes to Base64 in this tool (file upload is planned for a later release).
- Wrap the result: data:image/png;base64,YOUR_BASE64_HERE
- Use in HTML: <img src="data:image/png;base64,...">
- Use in CSS: background-image: url(data:image/png;base64,...)
- Pick Encode (text โ Base64) or Decode (Base64 โ text) at the top of the tool.
- Choose Standard or URL-safe; URL-safe automatically strips = padding. Auto-detect picks the right one when you paste.
- For email or PEM, set Line wrap to MIME 76. For data URIs and APIs, leave it at None.
- Open Advanced options to switch the source charset for non-UTF-8 text (Shift_JIS, GBK, Latin-1, ASCII, UTF-16).
- Use the swap button to round-trip the output back through the opposite mode and verify the result.
What is Base64 and why do I need it?
Base64 is a binary-to-text encoding scheme that represents binary data as a string of printable ASCII characters. It is commonly used to embed binary content (images, files) in text-based formats like HTML, CSS, JSON, and email (MIME). Developers use it when transferring data over protocols that only support text, such as inline images in CSS or binary attachments in APIs.
What is the difference between Base64 and Base64url?
Standard Base64 uses +, /, and = (padding). Base64url (URL-safe) replaces + with - and / with _, and typically omits padding. Base64url is used in JWTs, URL parameters, and filenames where +, /, and = would need extra encoding. This tool auto-detects the variant when decoding.
Is it safe to paste a JWT or password into this tool?
Yes. This tool runs 100% in your browser. Your input never leaves your device - there are zero network requests with your content, no server-side processing, and no third-party analytics that can read your input. After handling sensitive data like JWTs or API keys we recommend closing the tab as an extra precaution.
Why does my decoded text show strange characters?
Strange characters (mojibake) usually mean the original bytes used a character set other than UTF-8. Open Advanced options and pick a different source charset (for example Shift_JIS for Japanese, GBK for Chinese, or Latin-1 for older Western European text). The correct charset will produce readable text.
How do I encode an image as a Base64 data URI?
For now, encode the raw file bytes to Base64 and prepend the MIME prefix: data:image/png;base64, followed by the Base64 string. File upload with automatic MIME detection and data-URI generation is planned for a later release. The tool already supports pasting and decoding data URIs.
How do I remove or add = padding?
Use the Padding control above the input. "Keep =" preserves standard padding; "Strip =" removes trailing = characters from the output. URL-safe Base64 typically strips padding, while Standard Base64 keeps it. On decode, the tool re-adds missing padding automatically when it can.
What does "MIME line wrapping" mean in Base64?
MIME Base64 (used in email and PEM-encoded certificates) wraps the encoded output at 76 characters per line with a line break. This is required by RFC 2045. Use Line wrap > MIME 76 when generating Base64 for email or certificates. For APIs and data URIs, leave it at None.
Why is my Base64 string failing to decode?
Common causes: (1) the string contains invalid characters - the error points to the exact position; (2) it is URL-safe Base64 but the Standard variant is selected (try switching variants or let auto-detect handle it); (3) whitespace or line breaks are not being stripped (set Whitespace to Strip); (4) mixed Standard and URL-safe characters in the same string, which is invalid.
Can I use this tool offline?
Once the page loads, it works without an internet connection - all processing is client-side JavaScript. A fully installable PWA with offline support is planned for a future update.
What is the maximum input size?
The tool supports inputs up to 10 MB. Beyond this limit, conversion is refused with a clear message. For typical developer use (encoding strings, decoding tokens, working with data URIs) 10 MB is more than sufficient.