文本到十六进制
轻松将文本转换为十六进制表示
转换器工具
Enter text to convert to hexadecimal. Choose between UTF-8 (supports all characters) and ASCII (only 128 characters). Options to add spaces between hex values and use uppercase letters are available.
转换表:
Character | UTF-8 代码 | Hex Value |
---|
关于文本到十六进制转换
文本编码
文本字符在计算机中由数字表示。不同的编码系统对字符使用不同的数字:
ASCII
The ASCII (American Standard Code for Information Interchange) encoding uses 7 bits to represent 128 characters, including English letters (both uppercase and lowercase), digits, and common punctuation symbols. Each ASCII character can be represented by a unique number between 0 and 127.
UTF-8
UTF-8 是一种可变长度的字符编码,可以表示 Unicode 标准中的每个字符。它为每个字符使用 1 到 4 个字节。UTF-8 向后兼容 ASCII,这意味着前 128 个 UTF-8 字符与 ASCII 相同。
转换过程
将文本转换为十六进制涉及以下步骤:
- Determine the numerical value of each character using the chosen encoding (ASCII or UTF-8).
- Convert each numerical value to its hexadecimal (base-16) representation.
- (可选)用空格分隔每个十六进制值以提高可读性。
- (可选)将所有十六进制字母转换为大写。
示例:将“Hi”转换为十六进制
Step 1: Convert each character to its numerical value (ASCII):
H → 72
i → 105
步骤 2:将每个数值转换为十六进制:
72 → 48 (in hexadecimal)
105 → 69 (in hexadecimal)
Step 3: Combine the hexadecimal values (with spaces):
48 69
使用说明
- When using ASCII encoding, any character outside the 7-bit ASCII range (128-255) will be converted to a question mark (?).
- UTF-8 编码支持所有 Unicode 字符,包括特殊符号、表情符号和非英语语言中的字符。
- 如果每个 UTF-8 字符使用多个字节,则它可以由多个十六进制值表示。
- 十六进制值通常用于计算内存地址、颜色代码和二进制数据表示。