UTF-8 Base64 & URL Encoding / Decoding Standards
Base64 encoding translates arbitrary binary data and text into an ASCII string format composed of 64 printable characters (A–Z, a–z, 0–9, +, /). It is the standard representation for embedding image assets into CSS/HTML via Data URIs, transmitting authorization headers, and serializing cryptographic signatures across network boundaries.
Why Traditional JavaScript btoa and atob Fail on Multilingual Text
The built-in browser APIs window.btoa and window.atob were specified for Latin-1 single-byte character sequences. Attempting to encode Unicode characters outside of the 0x00–0xFF range (such as Chinese, Japanese, Arabic, accented characters, or emojis) triggers an immediate InvalidCharacterError DOMException or creates corrupt garbage strings.
Our encoder uses the native TextEncoder and TextDecoder web APIs with fail-closed fatal diagnostics, ensuring true byte-level UTF-8 fidelity across all writing systems and complex multi-codepoint emojis (including zero-width joiner sequences).
Standard Base64 vs. URL-Safe Base64 (RFC 4648 § 5)
Standard Base64 uses the plus sign (+) and forward slash (/) characters. When placed in URL query strings or path segments, these characters conflict with URL syntax delimiters. URL-Safe Base64 substitutes hyphen (-) for + and underscore (_) for /, and omits trailing equal signs (=) so the payload can be transmitted in query strings or HTTP headers without double-encoding.
URL Component vs. Complete URL Encoding
- URL Component Mode (
encodeURIComponent): Encodes every reserved punctuation mark (such as?,&,=,#,/,:) into percent-encoded hexadecimal triplets (e.g.%3F,%26,%3D). This is essential when embedding query parameter values that may themselves contain delimiters. - Complete URL Mode (
encodeURI): Preserves standard protocol delimiters and query separators (https://,?,&,=,#), encoding only invalid URL characters like spaces and Unicode codepoints.
RFC 2397 Data URI Scheme and Safe In-Browser File Decoding
The data: URI scheme allows small media assets (such as PNG icons, SVG vectors, or web fonts) to be embedded directly inline within HTML and CSS documents, eliminating additional HTTP round trips. Our tool preflights all files against memory guardrails (up to 20MB) to prevent browser tab crashes, inspects MIME media types and byte sizes, and safely decodes Data URIs back to downloadable byte-identical binary files with sanitized filenames.
Frequently Asked Questions
- 日本語や絵文字が文字化けしない理由は何ですか?
- ブラウザ標準の btoa/atob は Latin-1 のみ対応しており Unicode で例外が発生します。当ツールはネイティブの TextEncoder / TextDecoder を用いて厳密な UTF-8 バイト変換を行うため、漢字・ひらがな・絵文字も安全に変換できます。
- コンポーネントモードと完全 URL モードの違いは何ですか?
- コンポーネントモードは ? や & などの記号もエスケープしてクエリ値として埋め込めるようにします。完全 URL モードはアドレス構造の記号をそのまま維持します。
- ファイルが外部サーバーに送信されることはありますか?
- 一切ありません。すべての変換とダウンロード処理はお使いのブラウザメモリ上でローカルに完結します。