Number Base Converter
Convert between binary, octal, decimal, and hexadecimal.
Decimal (10)255
CopyBinary (2)11111111
CopyOctal (8)377
CopyHexadecimal (16)FF
CopyWhat It Does
Type any number in binary, octal, decimal, or hexadecimal and instantly see all four representations update in parallel. Useful for debugging bitfield operations, reading memory dumps, understanding color codes, and studying computer science number systems.
Number System Reference
- Binary (base 2) — Digits:
0 1. Each digit is one bit. Groups of 8 form a byte. - Octal (base 8) — Digits:
0–7. Used in Unix file permissions (e.g.chmod 755). - Decimal (base 10) — Digits:
0–9. The everyday number system. - Hexadecimal (base 16) — Digits:
0–9, A–F. Prefixed with0xin code.
Common Conversions
- 255 decimal = FF hex = 11111111 binary = 377 octal
- 16 decimal = 10 hex = 10000 binary = 20 octal
- 0x1F = 31 decimal = 11111 binary
- chmod 755 = 111 101 101 binary (rwx r-x r-x)
Practical Tips
- Hex colors:
#FF5733is R=255, G=87, B=51 in decimal. - IPv4 addresses in packet headers are stored as 32-bit integers — converting to hex can clarify subnet masks.
- Bitwise AND, OR, and XOR operations are easiest to understand in binary form.
Frequently Asked Questions
- How do I convert a decimal number to binary?
- Repeatedly divide the decimal number by 2 and record the remainders from bottom to top. For example, 13 ÷ 2 = 6 R1, 6 ÷ 2 = 3 R0, 3 ÷ 2 = 1 R1, 1 ÷ 2 = 0 R1 — reading remainders upward gives 1101₂. This tool does the conversion instantly for any value.
- Why is hexadecimal used in programming?
- Hexadecimal (base 16) is compact and maps cleanly to binary — each hex digit represents exactly 4 binary bits (one nibble). This makes hex ideal for representing memory addresses, color codes (#RRGGBB), byte values, bitfield masks, and hash outputs where binary would be too verbose.
- What is the octal number system used for?
- Octal (base 8) was popular on older computing architectures and is still used in Unix/Linux file permission modes. The permission string 755 is octal: 7 (rwx owner), 5 (r-x group), 5 (r-x others). Each octal digit maps to exactly 3 binary bits.
- How do I represent negative numbers in binary?
- Modern computers use two's complement representation for signed integers. To negate a number: flip all bits, then add 1. For example, +5 is 00000101, so -5 in 8-bit two's complement is 11111011. This converter works with unsigned (non-negative) integers.
- What do the hex prefixes 0x and 0b mean?
- These are language-level prefixes that tell parsers the numeric base. 0x prefix means hexadecimal (e.g. 0xFF = 255), 0b means binary (e.g. 0b1010 = 10), and 0o or a leading 0 means octal in many languages. They have no numeric value — they are purely syntactic.