跳到主要内容
Z

Binary vs Hexadecimal

Binary vs hex compared — base, readability and use cases, with free converters and a number base converter.

Binary (base 2) is how computers store data; hexadecimal (base 16) is a compact, human-friendly way to write the same bits — each hex digit equals exactly four binary digits.

Binary vs Hexadecimal at a glance

Binary Hexadecimal
Base 2 (0-1) 16 (0-9, A-F)
Digits per byte 8 2
Readability Low (long strings) High (compact)
Used for Bit-level logic Colours, memory, hashes

When to use Binary

Use binary when you reason about individual bits — flags, masks, low-level logic.

When to use Hexadecimal

Use hex to write bytes compactly — colour codes, memory addresses, hashes.

Tools for Binary & Hexadecimal

Binary vs Hexadecimal

这个工具只支持 ASCII 吗?

不是——底层引擎可以处理最高至 U+10FFFF 的任意 Unicode 码点。每行的“是否在 ASCII 范围内”标签会标明该字符是否属于原始的 7 位 ASCII 字符集(≤ 127)。

什么是 UTF-16 编码单元?

JavaScript 使用 UTF-16 存储字符串。大于 U+FFFF 的字符会占用两个 16 位编码单元(即一个代理对)。UTF-16 编码单元这一行展示的正是这些原始的 16 位编码。

为什么实时对照表限制在 200 个字符?

为每个字符渲染一行 DOM 元素,在粘贴长字符串时开销会很大。200 个字符已足够满足大多数检查需求——如需处理更大量的文本,建议改用代码编辑器进行处理。

需要原始字节而非码点?

可以使用我们的 String to Hex Converter 获取 UTF-8 字节输出,或使用 UTF-8 Converter 获取码点及 \u{HEX} 转义表示。