Base64 Encoder and Decoder
Encode and decode Base64 online with UTF-8 text, file, Data URL, and URL-safe support. Data stays in your browser.
This tool runs entirely in your browser. Your input is never uploaded.
What is Base64?
Base64 represents binary data with printable ASCII characters. It is commonly used to carry small binary values through text-based formats such as JSON, HTML, CSS, email, and URLs.
Base64 is not encryption. Anyone who receives the encoded value can decode it, so it should not be used to protect passwords, keys, or other sensitive information.
How to encode and decode text
- Select Text mode.
- Choose Encode or Decode.
- Enter UTF-8 text or Base64 content.
- Run the conversion, then copy or download the result.
This tool handles Chinese, emoji, and other Unicode text as UTF-8 instead of passing multibyte characters directly to the browser's btoa function.
Files and Data URLs
File mode can convert a local file to plain Base64 or a complete Data URL that includes its MIME type. Data URLs can be embedded in HTML or CSS, for example data:image/png;base64,....
When decoding a Data URL, its MIME type is used for the downloaded Blob. Plain Base64 contains no filename or media type, so it is downloaded as generic binary data.
Standard and URL-safe Base64
URL-safe Base64 replaces + and / with - and _, and it often omits trailing = padding. It is suitable for URLs, JWTs, and filenames. The decoder accepts both forms and restores omitted padding automatically.
Why does Base64 increase file size?
Four Base64 characters represent three bytes, so the encoded value is usually about one third larger than the original binary data. Base64 is not an efficient long-term representation for large files.
Privacy and security
Text and files are processed in your current browser and are never uploaded to a server. File contents are not intentionally persisted in local storage.
Frequently asked questions
Why does decoded Unicode text look corrupted?
The original bytes may not be UTF-8, or the encoder may have passed multibyte characters directly to btoa. This tool uses TextEncoder and a strict UTF-8 TextDecoder, reporting invalid bytes instead of silently producing corrupted text.
Why can Base64 decoding fail?
The input may contain invalid characters, incorrect padding, or an impossible encoded length. Regular spaces and line breaks are ignored automatically.