メインコンテンツへスキップ
Z

What is Base64?

Base64 is a binary-to-text encoding that represents binary data using 64 ASCII characters (A-Z, a-z, 0-9, + and /). It lets binary content like images or files travel safely through text-only systems such as JSON, email and data URIs, at the cost of being about 33% larger.

Base64 takes three bytes (24 bits) of input and encodes them as four 6-bit characters, padding with = when needed. It is encoding, not encryption — anyone can decode it, so it provides no security.

Common uses: embedding images in HTML/CSS (data URIs), attaching files in email (MIME), and carrying binary payloads inside JSON or URLs (with a URL-safe variant).

Base64 tools

よくある質問

\xABと\u{HEX}の違いは何ですか?

\xABはUTF-8の1バイトを表します——複数バイトの文字は複数のエスケープに展開されます。\u{HEX}はUnicodeのコードポイントを表し、UTF-8でのバイト数に関係なく1文字につき1つのエスケープで済みます。JSのテンプレートリテラルは\u{...}構文を解釈できます。

なぜ絵文字は4バイトも占めるのですか?

多くの絵文字はU+FFFFを超える位置にあるため、UTF-8では4バイト必要になります。コードポイントエスケープ形式(\u{1F680})を使えば、これらを1つの論理的な文字として表示できます。

混在した形式もデコードできますか?

いいえ——誤認識を防ぐため、入力はすべてhex、すべてdecimal、すべて\xAB、またはすべて\u{}のいずれかに統一する必要があります。混在した入力は分割して、それぞれ個別に処理してください。

Base64エンコードだけしたい場合は?

当サイトのBase64エンコーダー&デコーダーをご利用ください——テキストやファイルを入力するとBase64が得られます。