二进制 / 十六进制 / 十进制转换器

二进制、八进制、十进制和十六进制之间转换数字,并附有一个细目表。

十进制 —
二进 —
十六进制 —
八进 —
位数长度 —

输入结果时更新 。

这个计算器给你正确的答案了吗?

关于此计算器

A binary, hex and decimal converter shows the same whole number across number bases. Computers ultimately work in binary (base 2), but programmers routinely switch between bases to make values readable: decimal (base 10) for everyday quantities, hexadecimal (base 16) for byte values and memory addresses, and octal (base 8) for things like Unix file permissions. This converter takes a whole number in any of those four bases and shows it in all four at once, along with its bit length. The digits allowed in each base go up to one less than the base — binary uses 0–1, octal 0–7, decimal 0–9 and hex 0–9 then A–F for 10–15 — and the tool rejects digits that are out of range for the base you pick.

As a worked example, the decimal value 255 is FF in hexadecimal, 377 in octal and 11111111 in binary — eight bits all set, i.e. exactly one byte at its maximum. To convert decimal to hex by hand you repeatedly divide by 16 and read the remainders from last to first; the calculator does it instantly and also accepts input prefixed with 0x (hex), 0b (binary) or 0o (octal) and handles negative numbers.

The reason hexadecimal is so common in computing is that each hex digit maps to exactly four binary bits (a nibble), so two hex digits describe one byte with no ambiguity — which is why colour codes like #FF8800, MAC addresses and memory dumps are written in hex. This tool is handy for bit masks, colour values, debugging register contents and any low-level work where you need to see the same number across bases.

经常问到的问题

我如何将小数转换为十六进制?

Repeatedly divide by 16 and read the remainders from last to first, using A–F for 10–15. Decimal 255 is FF in hex and 11111111 in binary.

为什么十六进制用于计算?

每个十六位数的地图, 精确到四个二进制位数, 所以十六位数是一个紧凑的, 能够读取的方式 写字节值和内存地址—— 0xFF 是所有字节中的一个字节 。

我可以输入数字为 0x, 0b 或 0o 前缀吗?

是的。前导 0x (hex)、 0b (b) 或 0o (o(octal) 前缀被自动剥除, 这样您就可以直接粘贴代码中的值。 只要确保您选择的输入基数与输入的数字匹配 。

长度告诉我什么?

需要的数值是多少个二进制数字。 十进制 255 是 8 位数( 字节 ) ; 256 需要 9 位数。 位数长度对于选择数据类型和检查一个数值是否适合字节、 16 位数字或 32 位数注册值有用 。

八进制用于什么?

八进制组位元为三, 并主要出现在 Unix 文件权限( 类似 755 或 644) 和一些遗留系统中。 每八进制数字地图的精确度为三进制位数, 也就是每十六进制数字地图的精确度为四。

为什么我得到"这个基地的无效号码"?

选中基数不允许输入您输入的位数, 例如字母F 或二进制数中的位数 8, 仅允许 0和 1 。 切换输入基数以匹配您的值, 或者纠正外位数 。

❤️ 爱 Calculator.Free? 分享它

𝕏  X Facebook Reddit
API - 使用代码中的计算器

将此计算器称为自由 JSON 端点 。 不需要按键 。 将字段值发送到下面作为查询参数或 JSON 。 任何您省略的, 都会使用相同的默认值, 此页面预填的默认值是预填的; 未知参数是 400, 而不是静音零 。 读取 API 全部文件 →

终点

GET https://calculator.free/api/v1/binary-hex/

curl

curl "https://calculator.free/api/v1/binary-hex/?value=255&base=10"

JavaScript fetch()

const r = await fetch(
  "https://calculator.free/api/v1/binary-hex/?" + new URLSearchParams({
    "value": "255",
    "base": "10"
  }));
const data = await r.json();
console.log(data.results);

成果仅是一般指导的估计数,而不是财务、医疗或税务咨询。