Free Number Base Converter Online

Type in any field — Binary, Octal, Decimal, or Hex — and all other bases update instantly. Adjust bit width for two's complement representation of negative numbers.

Binary (Base-2)

Digits: 0–1. The native language of computers.
Invalid binary digit

Octal (Base-8)

Digits: 0–7. Common in Unix file permissions.
Invalid octal digit

Decimal (Base-10)

Digits: 0–9. Standard human-readable format.
Invalid decimal number

Hexadecimal (Base-16)

Digits: 0–F. Used for memory addresses, color codes, and binary dumps.
Invalid hex digit
Decimal 255 = Binary 11111111₂ = Hex FF₁₆ = Octal 377₈
Show calculation steps
No conversion in progress.

Usage Examples

Click any card to load the value into the converter

8-bit Max

Maximum unsigned 8-bit value

Dec255 Bin11111111 HexFF Oct377
Power of 2

1 Kilobyte (210 bytes)

Dec1024 Bin10000000000 Hex400 Oct2000
Fun

The Answer to Life, the Universe, and Everything

Dec42 Bin101010 Hex2A Oct52
Signed

Negative one — two's complement

Dec-1 8-bit11111111 HexFF 16-bitFFFF
Hex Magic

0xDEADBEEF — the classic hex spell

Dec3735928559 HexDEADBEEF Bin11011110... Oct33653337357
16-bit Max

Maximum unsigned 16-bit value

Dec65535 Bin1111111111111111 HexFFFF Oct177777

Key Features

bolt

Real-time Conversion

Type in any base field and all others update instantly.

adjust

Two's Complement

Full support for negative numbers with adjustable bit width (8, 16, 32, 64).

visibility

Clear Display

Optional prefixes (0b, 0o, 0x) and 4-bit binary grouping for readability.

list_alt

Step-by-Step

Toggle calculation steps to see exactly how each conversion is performed.

Frequently Asked Questions

General
What is the Number Base Converter?expand_more
The Number Base Converter instantly translates numbers between the four numeric systems engineers use every day: binary (base-2), octal (base-8), decimal (base-10), and hexadecimal (base-16). Type a number in any of the four input fields and all other bases update in real time. The tool also supports negative numbers via two's complement representation at selectable bit widths (8, 16, 32, or 64 bits).
How to Use This Toolexpand_more
  1. Enter a number in any of the four base fields — Binary, Octal, Decimal, or Hexadecimal. All other fields update instantly.
  2. Adjust the bit width (8, 16, 32, or 64) for two's complement negative number representation and zero-padding of binary output.
  3. Toggle prefix display (0b, 0o, 0x) and binary grouping (4-bit) for readability. Click any example to load a preset value.
Exampleexpand_more

Input:

Decimal: 255

Output:

Binary: 11111111
Octal: 377
Hexadecimal: FF
Details
What happens when I enter a decimal number larger than the selected bit width allows?expand_more
The tool truncates to fit within the selected bit width using modular arithmetic (wrapping). For example, entering 300 in 8-bit mode wraps around: 300 mod 256 = 44, so the 8-bit representation shows 44. This simulates real integer overflow behavior. To avoid wrapping, select a wider bit width.
How does two's complement handle the most negative number?expand_more
In two's complement, the most negative number has no positive counterpart within the same bit width. For 8-bit: -128 (10000000) cannot be represented as +128 in 8 bits because the maximum signed 8-bit value is +127. The tool handles this edge case correctly for each bit width.
How do hex and octal relate to binary more efficiently than decimal?expand_more
Both hexadecimal and octal map directly to groups of bits, which decimal does not. One hex digit represents exactly 4 bits (a nibble): 0xF = 1111. One octal digit represents exactly 3 bits: 7 = 111. This is why Unix file permissions use octal and memory addresses use hex.
Why are hex values like 0xDEADBEEF and 0xCAFEBABE commonly seen in debugging?expand_more
These are "hexspeak" — deliberately chosen 32-bit magic numbers that spell English words when read as hexadecimal. Engineers embed them in memory as sentinel values to detect buffer overflows, uninitialized memory access, or corrupted data structures.
Why does the binary output add leading zeros when I select a bit width?expand_more
The leading zeros (zero-padding) show the full width of the binary representation, which is essential when working with bitwise operations. This is critical for writing bitmasks, analyzing hardware registers, or implementing communication protocols where each bit position has a specific meaning.
How do I convert numbers between bases programmatically in JavaScript?expand_more
JavaScript provides built-in methods for base conversion. Use Number(42).toString(16) to convert decimal 42 to hex ("2a"). Use parseInt("2a", 16) to convert hex back to decimal (42). The toString() method supports bases 2 through 36. For bases outside this range or very large numbers, use BigInt: BigInt("0xff"). Python offers similar functions: bin(), oct(), hex(), and int("ff", 16). In Go, use strconv.FormatInt(42, 16) and strconv.ParseInt("2a", 16, 64).
What is the difference between signed and unsigned integer representations?expand_more
Signed integers can represent both positive and negative numbers, typically using two's complement encoding. Unsigned integers represent only non-negative numbers (0 and above). For an 8-bit value, unsigned ranges from 0 to 255, while signed ranges from -128 to 127. The same bit pattern (e.g., 11111111) represents 255 in unsigned and -1 in signed interpretation. This tool shows both when the "Show unsigned value" option is enabled, helping you understand how the same binary data can have two different numeric interpretations.
Why do IPv4 addresses and MAC addresses use different bases?expand_more
IPv4 addresses are typically written in dotted decimal (e.g., 192.168.1.1) because each octet ranges 0-255, which maps naturally to three-digit decimal values. MAC addresses use hexadecimal (e.g., AA:BB:CC:DD:EE:FF) because each hex digit maps to exactly 4 bits, and a MAC address is 6 bytes = 12 hex digits = 48 bits. Hexadecimal makes it trivial to read individual bytes and bit patterns. This is also why memory addresses in debuggers are displayed in hex — each hex digit directly maps to 4 bits, making byte boundaries visually clear.
How does base conversion differ for floating-point numbers?expand_more
Floating-point numbers introduce complexity because the fractional part may not terminate in another base. For example, 0.1 in decimal is 0.0001100110011... in binary (a repeating fraction). IEEE 754 floating-point representation handles this by storing a mantissa and exponent, trading precision for range. This tool focuses on integer conversion, which always yields exact results between bases. For floating-point analysis, consider IEEE 754 converters that show the exact binary representation of single-precision (32-bit) and double-precision (64-bit) floats.

Learn more about number systems from MDN's parseInt() documentation, the Wikipedia article on two's complement, and IEEE 754 floating-point standard.

Last updated: July 14, 2026