256 Tools

Base64 Decode & Encode — UTF-8 Safe, URL-Safe & Image to Data URL

File → Base64 / data URL

Drop a file here, or click the button below

Paste text or Base64 above, or drop a file below.

Your text and files are processed entirely in your browser and never sent to a server.

Related external tools

Some links are affiliate links.

Related tools

This free Base64 encoder and decoder converts text to Base64 or Base64 back to text instantly, right in your browser. Unlike simple tools that use btoa() directly, this tool processes text through UTF-8 byte encoding first — so Japanese, emoji and any Unicode character work correctly without corruption. Switch between standard and URL-safe Base64 (base64url), drop an image to generate a data URL with preview, copy results with one click, and download decoded text. No registration, no upload — everything is private and browser-only.

How to use

  • Paste any text into the input box to encode it to Base64 instantly — or paste a Base64 string to decode it back to text.
  • Use Auto mode to let the tool detect whether your input is Base64 (and decode it) or plain text (and encode it). The judgment is shown so you can override it.
  • Switch between Standard Base64 and URL-safe Base64 (base64url, using - and _ instead of + and /) for URLs, query strings and JWTs.
  • Drop an image or other file onto the drop zone to generate the raw Base64 string and a self-contained data URL. Images are previewed immediately.
  • Copy the result with one click, or download decoded text as a .txt file. Use Swap to move the result back to the input for reverse conversion.
  • No install, no sign-up. Your input and files are processed only in your browser — nothing is ever sent to a server.

What is Base64? Encode and decode explained

Base64 is an encoding scheme that represents binary or multi-byte data using only 64 printable ASCII characters: A–Z, a–z, 0–9, + and / (with = for padding). It is widely used to safely transport data in contexts that only handle plain text — such as email headers, JSON fields, HTTP authentication, JWTs, and HTML/CSS embed strings. Base64 is not encryption: anyone can decode it back to the original data.

Encode (text → Base64)

Encoding converts your text to UTF-8 bytes first, then represents those bytes as a Base64 string. The result is around 4/3 the size of the original. The UTF-8 step is what makes Japanese and emoji work — direct btoa() on a multi-byte string causes errors or garbled output in many tools.

Decode (Base64 → text)

Decoding reverses the process: the Base64 string is converted back to bytes, then those bytes are interpreted as UTF-8 text. If the bytes cannot be decoded as valid UTF-8 (e.g. for binary files like images), an error is shown rather than garbled text.

Auto mode

Auto mode looks at your input and tries to determine whether it is Base64 (and should be decoded) or plain text (and should be encoded). The judgment is displayed — if auto gets it wrong, just click Encode or Decode to override. For example, 'Hello' has 5 characters (not a multiple of 4 in Base64 terms), so it is encoded; SGVsbG8= is a valid Base64 string, so it is decoded.

Diagram: text → UTF-8 bytes → Base64 encoding flowTexte.g. "Hello"TextEncoderUTF-8 Bytes48 65 6C 6C 6Fbtoa()Base64SGVsbG8=

Key features

UTF-8 safe — Japanese, emoji and any Unicode work

Most simple tools call btoa() directly on a multi-byte string, which throws an error or produces garbled output for Japanese, Chinese, Korean, emoji and other non-ASCII text. This tool converts the string to UTF-8 bytes first using TextEncoder, then encodes those bytes with btoa() — so 日本語 and 😀 round-trip perfectly without any corruption.

URL-safe Base64 (base64url)

Standard Base64 uses + and / and = characters which are special in URLs and file names. URL-safe Base64 (base64url) replaces + with -, / with _, and removes the = padding. This makes it safe to use in URL query parameters, JWTs, file names and other contexts where + or / would cause problems. When decoding, the tool accepts both standard and URL-safe Base64 automatically.

Diagram: Standard Base64 vs URL-safe Base64 (base64url) character setsStandard Base64A-Z a-z 0-9 + / =URL-safe (base64url)A-Z a-z 0-9 - _

File → Base64 and data URL (with image preview)

Drop any file (image, font, document, etc.) onto the drop zone to generate the raw Base64 string and a self-contained data URL (data:<mime>;base64,...). Images are previewed inline. The data URL can be pasted directly into CSS background-image, HTML <img> src, or Markdown to embed the image without an external file. The data URL is always self-contained — no blob: references that would break outside the browser tab.

Clear error messages for invalid Base64

When the input cannot be decoded as Base64, the tool explains why: invalid characters (and where), wrong length, failed decoding, or binary data that cannot be interpreted as UTF-8. Errors are shown as text, not just color, so they are accessible to screen readers.

Copy, download and character/byte counts

Copy the result with one click. Download decoded text as a .txt file. The input and output areas both show character count and UTF-8 byte count — useful for seeing how Base64 increases the size by approximately 4/3 compared to the original.

Private — runs entirely in your browser

Your text, tokens, API keys, and file contents are processed only in your browser. Nothing is sent to a server. This makes the tool safe to use with sensitive or confidential data.

Use cases

Decode a Base64 string to read its content

Paste a Base64 string from an email header, config file, JWT payload fragment, or API response to see the original text or JSON. Switch to decode mode (or use auto) and the result appears instantly.

Encode Japanese or emoji text to Base64

Need to embed Japanese, emoji or other non-ASCII characters in a JSON field, HTTP header or config file? Paste the text and encode it — the UTF-8 safe encoding ensures the round-trip is lossless, unlike tools that use btoa() directly.

Generate URL-safe Base64 (base64url) for URLs and JWTs

When you need Base64 that is safe in a URL query string, path segment, JWT, or file name, switch to URL-safe mode. The output uses - and _ instead of + and /, with no = padding. Paste the result directly into your URL or JWT without percent-encoding.

Convert an image to a data URL for HTML/CSS embedding

Small icons and images can be embedded directly in HTML, CSS or Markdown as data URLs, eliminating an extra HTTP request. Drop your image file onto the drop zone to get data:image/png;base64,... (or the relevant MIME type) with an instant preview. Copy the data URL and paste it into your code.

Notes and limitations

  • Base64 is not encryption — anyone can decode it. Do not use Base64 to protect passwords or secrets.
  • Base64 increases the data size by approximately 4/3 (33%). Be mindful of this when embedding large images as data URLs.
  • This tool encodes and decodes UTF-8 text. Other encodings (Shift_JIS, EUC-JP, UTF-16, etc.) are not supported.
  • Binary data (images, PDFs, etc.) that has been Base64-encoded cannot be decoded to text — it can only be decoded to bytes. Use the file output feature to generate a data URL instead.
  • Your input and files are never sent to a server. Everything runs locally in your browser.

Frequently asked questions

Will Japanese or emoji encode/decode correctly without garbling?
Yes. This tool converts text to UTF-8 bytes using TextEncoder before encoding, and uses TextDecoder with strict UTF-8 mode when decoding. Japanese, Chinese, Korean, emoji and surrogate-pair characters all round-trip without corruption — unlike tools that call btoa() directly on multi-byte strings.
Can I both encode and decode Base64?
Yes. Paste text to encode it to Base64, or paste a Base64 string to decode it back to text. Auto mode detects which direction to go and shows the judgment; you can always override by selecting Encode or Decode explicitly.
Is URL-safe Base64 (base64url) supported?
Yes. Switch to URL-safe mode to get base64url output (- and _ instead of + and /, no = padding). When decoding, the tool accepts both standard and URL-safe Base64 automatically — you don't need to switch modes just to decode a base64url string.
Can I convert an image to Base64 or a data URL?
Yes. Drop an image (or any file) onto the drop zone to get the raw Base64 string and the full data URL (data:image/...;base64,...). Images are previewed immediately. The data URL is self-contained and can be pasted directly into HTML, CSS or Markdown.
Is my data sent to a server?
No. Everything runs in your browser using standard JavaScript APIs (TextEncoder, TextDecoder, btoa, atob, FileReader). Your text, tokens, keys and file contents are never uploaded to any server.
Is Base64 a form of encryption?
No. Base64 is an encoding, not encryption. Anyone who has the Base64 string can decode it back to the original data with no key or password. Do not use Base64 to protect sensitive information.
Can I copy or download the result?
Yes. Click Copy to copy the result to your clipboard with one click. When you decode Base64 to text, a Download button lets you save the result as a .txt file.

We use cookies for ads and analytics.