DevToolBox

HEX Converter

テキスト・HEX・バイナリを相互変換します。スペース区切りの16進数形式に対応。

 

How to Use the HEX Converter

This free online HEX converter lets you convert between text, hexadecimal, and binary formats instantly in your browser. Select a conversion mode from the tabs at the top, enter your input, and see the result immediately. The tool supports four conversion directions: Text to HEX, HEX to Text, HEX to Binary, and Binary to HEX. All hexadecimal output uses space-separated uppercase format (e.g., "48 65 6C 6C 6F" for "Hello"), which is the most commonly used format in debugging, network analysis, and data inspection tools.

Understanding Hexadecimal Notation

Hexadecimal (base 16) is a numeral system that uses sixteen distinct symbols: the digits 0 through 9 represent values zero to nine, and the letters A through F represent values ten to fifteen. Each hex digit represents exactly four bits (a nibble), making it a convenient shorthand for binary data. Two hex digits represent one byte (8 bits), which can hold values from 00 to FF (0 to 255 in decimal). This compact representation is why hexadecimal is ubiquitous in computing -- from color codes in CSS (#FF5733) to memory addresses, MAC addresses, and raw data dumps.

Text to HEX Conversion

When converting text to hexadecimal, each character is first encoded as bytes using UTF-8 encoding, then each byte is represented as a two-digit hexadecimal number. ASCII characters like letters and digits produce one byte (two hex digits) each, while non-ASCII characters such as Japanese, Chinese, or emoji produce multiple bytes. For example, the letter "A" becomes "41", while a Japanese character like "a" becomes "E3 81 82" (three bytes in UTF-8). This conversion is useful for inspecting raw byte content, debugging encoding issues, and preparing data for protocols that require hex-encoded payloads.

Binary and HEX Interconversion

Converting between binary and hexadecimal is straightforward because each hex digit maps to exactly four binary digits. For example, hex "4F" equals binary "01001111". The tool expects space-separated groups of 8 binary digits (one byte each) for Binary to HEX conversion, and space-separated pairs of hex digits for HEX to Binary conversion. This is essential for low-level programming, hardware design, and understanding bit-level data representations. Input validation ensures that only valid characters are accepted, with clear error messages in Japanese for any invalid input.

Features

  • Four conversion modes: Text to HEX, HEX to Text, HEX to Binary, Binary to HEX
  • Space-separated hex format for readability
  • UTF-8 encoding for text conversion
  • Input validation with Japanese error messages
  • One-click copy to clipboard
  • Client-side only -- your data stays in your browser

HEX変換ツールの使い方

この無料オンラインツールは、テキスト・HEX(16進数)・バイナリの相互変換を行います。 上部のタブから変換モードを選択し、入力欄にデータを入力すると即座に結果が表示されます。 4つの変換方向に対応しており、全ての処理はブラウザ上で完結します。

16進数とは

16進数は0-9とA-Fの16個の記号を使う記数法です。2桁の16進数で1バイト(0-255)を表現でき、 バイナリデータの簡潔な表記として広く使われています。CSSの色コード(#FF5733)、 メモリアドレス、MACアドレスなど、プログラミングの様々な場面で登場します。

テキストとHEXの変換

テキストからHEXへの変換では、UTF-8エンコーディングでバイト列に変換した後、 各バイトを2桁の16進数で表現します。ASCII文字は1バイト、日本語文字は通常3バイト、 絵文字は4バイトとなります。エンコーディングの問題をデバッグする際に便利です。

Hex to Byte Converter — what the bytes mean

When you use this page as a hex to byte converter, each two-digit pair (00–FF) maps to one byte (0–255). Spaces between pairs are optional separators for readability. Converting hex to bytes is the first step when you inspect binary protocols, file headers (magic numbers like 89 50 4E 47 for PNG), or debug character encoding issues — and converting hex back to text decodes those bytes as UTF-8.

よくあるエラーと対処 / Common Errors and Fixes

エラー / Error原因 / Cause対処 / Fix
無効なHEX値
Invalid hex value
0-9, A-F 以外の文字(O と 0、l と 1 の混同が典型)
Characters outside 0-9/A-F — often O vs 0 or l vs 1 confusion
コピー元を確認。プレフィックス 0x や区切りのカンマは除去する
Strip 0x prefixes and comma separators before pasting
奇数桁のHEX
Odd number of hex digits
1バイト=2桁のため、奇数桁はバイト列に変換できない
One byte needs exactly two digits; odd-length input is ambiguous
先頭に 0 を補う(例: F → 0F)か、欠落した桁を確認
Left-pad with 0 (F → 0F) or find the missing digit
HEX→テキストが文字化け・失敗
Hex to text fails or shows garbage
バイト列が UTF-8 として不正(Shift_JIS等の別エンコーディング、または画像等のバイナリ)
The bytes are not valid UTF-8 — different encoding or pure binary data
元データのエンコーディングを確認。バイナリはテキスト化せず HEX のまま扱う
Verify the source encoding; keep binary data as hex
エンディアンの取り違え
Endianness mix-up
多バイト数値はリトルエンディアンだとバイト順が逆(0x1234 → 34 12)
Little-endian stores multi-byte numbers in reverse byte order
数値として解釈する場合はプロトコル仕様のバイト順を確認
Check the protocol's byte order before interpreting as numbers
日本語が想定よりバイト数が多い
Japanese text yields more bytes than expected
UTF-8では日本語は1文字3バイト、絵文字は4バイト以上
UTF-8 encodes Japanese in 3 bytes, emoji in 4+ bytes
仕様。バイト数制限のあるシステムでは事前にバイト長を確認する
By design — check byte length against system limits

言語別コード例 / Code Examples

JavaScript

// テキスト → HEX
const hex = Array.from(new TextEncoder().encode("Hello"))
  .map((b) => b.toString(16).padStart(2, "0")).join(" ");
// "48 65 6c 6c 6f"

// HEX → テキスト
const bytes = new Uint8Array("48 65 6c 6c 6f".split(" ").map((h) => parseInt(h, 16)));
const text = new TextDecoder().decode(bytes); // "Hello"

Python

"Hello".encode("utf-8").hex(" ")        # '48 65 6c 6c 6f'
bytes.fromhex("48 65 6c 6c 6f").decode() # 'Hello'

Shell (xxd)

printf 'Hello' | xxd -p     # 48656c6c6f
echo 48656c6c6f | xxd -r -p  # Hello

Go

import "encoding/hex"
h := hex.EncodeToString([]byte("Hello"))  // "48656c6c6f"
b, _ := hex.DecodeString("48656c6c6f")    // []byte("Hello")

変換例 / Before & After

テキスト → HEX:
"Hello"   → 48 65 6C 6C 6F
"こんにちは" → E3 81 93 E3 82 93 E3 81 AB E3 81 A1 E3 81 AF  (3バイト×5文字)

HEX → バイナリ:
48 65 → 01001000 01100101

ファイルヘッダの識別(マジックナンバー):
89 50 4E 47 → PNG画像 / FF D8 FF → JPEG / 50 4B → ZIP

Why browser-only?

Hex dumps often come from places you should not paste into random websites: memory dumps, packet captures, auth tokens, or proprietary file formats. This hex to byte converter runs entirely in your browser with TextEncoder/TextDecoder — the data never leaves your device, there is no upload, no logging, and it keeps working offline. Verify it yourself in the DevTools Network tab.

HEXダンプの中身はメモリダンプ・パケットキャプチャ・トークンなど機密データであることが多いもの。 本ツールは変換の全てがブラウザ内で完結し、データは一切外部送信されません。

開発をもっと効率的に

PR