Number Base Converter

Convert between decimal, binary, octal, hex, and any base 2โ€“36. Live conversion.

Convert

Decimal base 10
Binary base 2
Octal base 8
Hexadecimal base 16
Base
Custom Base base 36

What is Number Base Converter?

Number Base Converter converts integers between decimal (base 10), binary (base 2), octal (base 8), and hexadecimal (base 16), with live updates as you type in any field. It also converts to and from any arbitrary base (2-36) and shows the step-by-step conversion process โ€” how the division algorithm produces each digit.

Number bases represent values using different sets of digits. Decimal (base 10) uses 0-9. Binary (base 2) uses 0 and 1 โ€” the native language of computers. Octal (base 8, 0-7) was historically used for Unix permissions and some file formats. Hexadecimal (base 16, 0-9, A-F) is the standard for memory addresses, color values (#FF5733), and binary data representation.

Hexadecimal is everywhere in computing: RGB colors (#RRGGBB, where each component is 0-255 = 00-FF in hex), memory addresses (0x7fff5fbff8a8), Unicode code points (U+1F600), byte values in network packets, and SHA-256 hashes. Binary is the native representation of integers in CPUs โ€” understanding binary helps with bitwise operations, bit flags, and low-level programming.

How to Use

  1. Type a number in any of the four fields (decimal, binary, octal, hex) โ€” all others update instantly.
  2. For hexadecimal input, you can use either uppercase (A-F) or lowercase (a-f).
  3. For bases other than these four, enter the base number and value in the custom base fields.
  4. Enable 'Show steps' to see the division algorithm that produces each digit.
  5. Use the bit width selector (8-bit, 16-bit, 32-bit, 64-bit) to see two's complement representation.

Examples

Decimal 255 to hex

Result: 255 โ†’ FF in hexadecimal (used in RGB colors: #FFFFFF is white, #FF0000 is red)

Hex color to RGB

Result: #FF5733 โ†’ R:255, G:87, B:51 in decimal โ€” break into pairs: FF=255, 57=87, 33=51

Binary to decimal (bitwise)

Result: 0b10110101 โ†’ 181 decimal (128+32+16+4+1) โ€” understanding individual bits helps with flag manipulation

Frequently Asked Questions

Why does hexadecimal use A-F?

Hexadecimal needs 16 distinct symbols. Decimal digits 0-9 cover the first 10, then A=10, B=11, C=12, D=13, E=14, F=15. This notation was standardized so a single character always represents exactly 4 bits (a 'nibble'). Two hex characters represent exactly 8 bits (one byte), making hex ideal for compact byte representation.

What is two's complement?

Two's complement is the standard way computers represent negative integers in binary. To negate a number: flip all bits (one's complement) and add 1. In 8-bit two's complement, -1 is 11111111 (255 unsigned), -128 is 10000000 (128 unsigned). The most significant bit is the sign bit: 0 = positive, 1 = negative.

What does 0x mean before a hex number?

0x is the standard prefix in programming languages to indicate a hexadecimal literal. 0xFF = 255, 0x1A3F = 6719. Similarly, 0b indicates binary (0b1101 = 13) and 0o indicates octal (0o17 = 15) in languages like Python, JavaScript, and C. In CSS, hex colors use # instead (e.g., #FF0000).

How do I convert a negative decimal to binary?

Use two's complement. For -42 in 8 bits: take 42 (00101010), flip all bits (11010101), add 1 (11010110). To verify: 11010110 = 128+64+16+4+2 = 214. And 256-214 = 42, confirming the magnitude. Most programming languages use two's complement internally.

What base does IP address use?

IPv4 addresses are decimal numbers separated by dots (192.168.1.1), where each octet is 0-255 (one byte = 8 bits). IPv6 addresses are hexadecimal groups separated by colons (2001:0db8:85a3::8a2e:0370:7334). CIDR subnet masks use the same decimal dot notation with a /prefix for the network bits.

Related Tools