进制转换器
二进制、八进制、十进制、十六进制实时互转。
| Decimal | Binary | Octal | Hex | 描述 |
|---|
About the Number Base Converter
This free online tool lets you convert numbers between the four most common numeral systems — binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16) — simultaneously and in real time. Just type in any field and all others update instantly.
What is a Number Base?
A number base (or radix) defines how many unique digits are used to represent numbers. Decimal uses 10 digits (0–9), binary uses 2 (0–1), octal uses 8 (0–7), and hexadecimal uses 16 (0–9 plus A–F). Each base is used in different computing and engineering contexts.
Common Use Cases
- Binary ↔ Decimal — understanding CPU registers, flags, and bitmasks
- Hex ↔ Decimal — memory addresses, color codes (#RRGGBB), Unicode code points
- Octal ↔ Decimal — Unix file permission flags (e.g., 755 = rwxr-xr-x)
- Two's complement — how negative integers are stored in binary
- Color preview — any 3 or 6 hex digit value is previewed as a CSS color
How Two's Complement Works
In 32-bit signed arithmetic, the most significant bit (MSB) represents the sign. A value of
0xFFFFFFFF is 4294967295 unsigned but -1 signed.
To negate a binary number: invert all bits and add 1. This converter shows both interpretations.
Hexadecimal & Web Colors
CSS colors are written as 3-digit (#RGB) or 6-digit (#RRGGBB) hex strings.
When you enter a valid hex color value this tool automatically shows a live color swatch preview.