比較解説ガイド

Base64 vs Hex — どのバイナリ-テキスト エンコーディング

Base64 vs hex 比較。オーバーヘッド、可読性、用途 (crypto、HMAC、SHA)。各フォーマットいつ選ぶ。

Base64とHex(16進数)の主な違い

Both Base64 and Hex (Hexadecimal) are binary-to-text encoding methods used to represent raw byte sequences as text strings. However, their size efficiency and character sets differ significantly.

FeatureBase64Hexadecimal (Hex)
Alphabet Size64 characters (A-Z, a-z, 0-9, +, /)16 characters (0-9, A-F)
Size Expansion+33.3% overhead+100% overhead (2x size)
Bits per Character6 bits4 bits (nibble)
Primary Use CasesEmail attachments (MIME), Data URLs, JWT payloads, API responsesCryptographic hash outputs (SHA256, MD5), memory inspection, MAC addresses

HexではなくBase64を選択すべき場合

Choose Base64 when payload size matters. Because Base64 expands binary data by only ~33% compared to Hex's 100% expansion, Base64 saves significant network bandwidth when embedding images, converting documents, or sending large API payloads.

Learn more in our main What is Base64 Guide or test conversion live with our Hex ↔ Base64 Converter Tool.