十六进制转文本转换器

这个十六进制转文本转换器使用 UTF-8 字符编码,在十六进制字节值和可读文本之间相互转换。粘贴十六进制代码(带或不带空格、0x 前缀或短横线)以解码为文本,或输入文本以查看其十六进制表示。

Hex to Text Converter

Convert text to hexadecimal or decode hex strings back to readable text

Frequently Asked Questions

什么是十六进制?

十六进制(hex)是一种以16为基数的数字系统,使用0-9和A-F来表示值。每个十六进制数字代表四个二进制位,因此两个十六进制数字代表一个字节(8位)。例如,十六进制值"FF"等于十进制255和二进制11111111。十六进制在计算中被广泛使用,因为它提供了一种紧凑、便于人类阅读的表示二进制数据的方式。

十六进制如何表示文本?

文本在计算机中使用ASCII和UTF-8等字符编码方案以字节序列存储。每个字符被分配一个数值码点,然后编码为一个或多个字节。文本的十六进制表示就是每个字节的十六进制值。例如,ASCII中的"Hello"是48 65 6c 6c 6f——其中48是"H"的十六进制值(十进制72),65是"e"(十进制101),依此类推。

ASCII和UTF-8有什么区别?

ASCII是一种7位编码,定义了128个字符(0-127),涵盖英文字母、数字、标点和控制字符。UTF-8是一种与ASCII向后兼容的可变宽度编码——前128个字符完全相同。但UTF-8可以使用1到4字节编码所有Unicode字符,支持每种世界文字、符号和表情符号。所有有效的ASCII文本也是有效的UTF-8。

0x前缀是什么意思?

"0x"前缀是C、C++、Java、JavaScript和Python等编程语言中用于表示数字以十六进制(基数16)书写的约定。例如,0x41表示十六进制值41(十进制65,即字母"A")。前缀本身没有数值——它只是告诉编译器或解释器将后面的数字解析为基数16而不是基数10。

为什么使用十六进制而不是二进制或十进制?

十六进制在可读性和与二进制数据的对齐之间取得了理想的平衡。每个十六进制数字精确映射到4位,因此一个字节始终是两个十六进制数字(00到FF)。二进制对人类阅读过于冗长(一个字节是8位数字),而十进制与字节边界不整洁对齐。十六进制使读取内存地址、颜色代码、MAC地址、哈希值和其他面向字节的数据变得容易。

如何手动将十六进制转换为文本?

手动将十六进制转换为文本:(1)将十六进制字符串拆分为两位一组——每对代表一个字节。(2)将每对十六进制转换为十进制值(例如,十六进制48 = 4×16+8 = 72十进制)。(3)在ASCII表中查找十进制值对应的字符(72="H")。(4)组合所有字符形成文本。对于UTF-8多字节字符,多个十六进制对组合成一个字符。

此工具可以处理Unicode和表情符号吗?

是的,本转换器完全支持UTF-8编码,包括所有Unicode字符——拉丁文字、CJK字符、阿拉伯文、西里尔文、数学符号和表情符号。多字节字符将产生多个十六进制字节对。例如,表情符号"😀"在UTF-8中编码为4字节:f0 9f 98 80。字符细分表单独显示多字节字符的每个字节。

如何读取十六进制转储?

十六进制转储以十六进制字节值行以及对应的ASCII表示来显示文件或内存内容。每行通常显示偏移量(内存地址)、16个十六进制字节值和对应的可打印字符(不可打印字节显示为点)。例如:"00000000 48 65 6c 6c 6f 20 57 6f 72 6c 64 21 |Hello World!|"。xxd、hexdump和od等工具在命令行中生成十六进制转储。

如何在Python或JavaScript中将十六进制转换为文本?

在Python中,使用bytes.fromhex("48656c6c6f").decode("utf-8")得到"Hello"。将文本转换为十六进制:"Hello".encode("utf-8").hex()返回"48656c6c6f"。在JavaScript中,十六进制转文本:hex.match(/.{2}/g).map(b => String.fromCharCode(parseInt(b, 16))).join("")。文本转十六进制:[...text].map(c => c.charCodeAt(0).toString(16).padStart(2, "0")).join("")。

十六进制转文本和十六进制转十进制有什么区别?

十六进制转文本使用ASCII或UTF-8编码将十六进制字节值转换为可读字符(例如,"48 65 6c 6c 6f"变为"Hello")。十六进制转十进制将十六进制数转换为其基数10的等值(例如,"FF"变为255)。十六进制转文本将十六进制解释为字符编码,而十六进制转十进制是纯数学的进制转换。

About Hex to Text Converter

The Hex to Text Converter is a utility that translates between human-readable text and its hexadecimal byte representation. It encodes each character of your text into hex values based on UTF-8 encoding, and decodes hex strings back into readable text. This tool is essential for developers, network engineers, and anyone working with binary data, memory dumps, or low-level protocols.

How to Use the Hex to Text Converter

  1. Select the "Text to Hex" tab to convert text to hexadecimal, or the "Hex to Text" tab to decode hex back to text
  2. Type or paste your input into the text area
  3. For Text to Hex, choose your preferred separator format (space, none, 0x prefix, or comma)
  4. The converter processes your input instantly in real time
  5. View the character breakdown table for detailed byte-level analysis
  6. Click the copy button to copy the result to your clipboard

What is Hexadecimal?

Hexadecimal (hex) is a base-16 number system that uses sixteen distinct symbols: the digits 0–9 represent values zero through nine, and the letters A–F (or a–f) represent values ten through fifteen. Each hex digit represents exactly four binary bits (a nibble), making it a compact and convenient way to express binary data. Two hex digits together represent a single byte (8 bits), with values ranging from 00 (0) to FF (255).

How Hex Represents Text (ASCII / UTF-8)

Computers store text as sequences of bytes using character encodings. In ASCII, each character maps to a single byte value between 0 and 127. For example, the letter "A" is stored as byte value 65, which is 41 in hex. UTF-8 extends ASCII to support all Unicode characters: ASCII characters remain one byte, while other characters use two to four bytes. The hex representation of text is simply the hex values of each byte in sequence.

Common Hex Values

Here are common characters and their hexadecimal, decimal, and binary equivalents:

CharacterHexDecimalBinary
Space203200100000
0304800110000
9395700111001
A416501000001
Z5a9001011010
a619701100001
z7a12201111010
!213300100001
@406401000000
#233500100011
\5c9201011100
/2f4700101111

ASCII Reference Table

The printable ASCII characters range from hex 20 (space) to hex 7e (tilde). Control characters occupy 001f and 7f. Here are the full printable ranges:

RangeHexCharacters
Digits30–390 1 2 3 4 5 6 7 8 9
Uppercase41–5aA B C D ... X Y Z
Lowercase61–7aa b c d ... x y z
Symbols20–2f, 3a–40, 5b–60, 7b–7eSpace, punctuation, brackets, etc.

Common Use Cases

  • Debugging — Inspect raw byte values in network packets, file contents, or memory dumps to diagnose encoding issues
  • Network Analysis — Read and interpret hexadecimal data captured from network traffic (TCP/UDP payloads, HTTP bodies)
  • Cryptography — Hex is the standard notation for hash digests (SHA-256, MD5), encryption keys, and ciphertext output
  • Programming — Convert between hex literals and text for string manipulation, color codes (e.g., #FF5733), and byte-level operations
  • Data Formats — Decode hex-encoded fields in JSON, XML, database BLOBs, and serialized data structures
  • Embedded Systems — Work with firmware dumps, EEPROM contents, and serial communication data in hex format

Tips for Working with Hex

  • Each byte is always represented by exactly two hex digits (e.g., 0a not a)
  • Hex is case-insensitive: 4a and 4A represent the same byte value (74 in decimal)
  • The 0x prefix is a common notation in programming languages (C, JavaScript, Python) to indicate a hex literal
  • For multi-byte UTF-8 characters (accented letters, CJK, emoji), each character produces multiple hex byte pairs
  • When decoding, ensure your hex string has an even number of digits — an odd count indicates incomplete data

Related Tools