DevBolt
Processed in your browser. Your data never leaves your device.

How do I convert numbers between binary, decimal, and hexadecimal?

Enter a number in any base — binary, octal, decimal, or hexadecimal — and instantly see it converted to all other bases. The tool handles large numbers and updates in real time as you type. Everything runs in your browser.

Decimal to hexadecimal
Input
255
Output
Hex: FF
Binary: 11111111
Octal: 377
← Back to tools

Number Base Converter

Convert numbers between binary, octal, decimal, and hexadecimal. Results update as you type.

About Number Base Conversion

  • Supports arbitrarily large numbers using BigInt — no precision loss.
  • Use prefixes for quick input: 0b for binary, 0o for octal, 0x for hex.
  • Underscores in input are ignored for readability (e.g. 1_000_000).
  • Everything runs in your browser — no data is sent over the network.

Tips & Best Practices

Pro Tip

Use hex for colors and memory addresses, binary for bit flags

Each number base has its sweet spot: hexadecimal for colors (#FF5733), memory addresses, and byte values. Binary for bitwise operations and feature flags. Octal for Unix file permissions (chmod 755). Decimal for everything humans need to read.

Common Pitfall

JavaScript parseInt() defaults to base 10, not auto-detect

parseInt('010') returns 10 in modern JS (base 10), but returned 8 in older engines (octal). Always specify the radix: parseInt('0xFF', 16) for hex, parseInt('111', 2) for binary. The implicit radix has caused countless subtle bugs.

Real-World Example

Hex is just a compact way to write binary

Each hex digit maps to exactly 4 binary bits: 0xF = 1111, 0xA = 1010. This makes hex ideal for reading binary data — a 32-bit value like 11111111000000001010101001010101 becomes FF00AA55, which is actually readable.

Security Note

Validate numeric inputs to prevent injection via unusual bases

Attackers sometimes bypass input validation by encoding payloads in hex (0x) or octal (0). Ensure your input parsing handles all numeric representations consistently and doesn't accidentally interpret user input as a different base.

Frequently Asked Questions

How do I convert between decimal, binary, octal, and hexadecimal?
Enter a number in any base and DevBolt instantly shows the equivalent value in all four bases: decimal (base 10), binary (base 2), octal (base 8), and hexadecimal (base 16). The tool handles both integers and large numbers. This is essential for low-level programming, bitwise operations, memory address analysis, and understanding how computers store data. Each base serves different purposes: decimal for human-readable values, binary for bit manipulation, hex for memory addresses and color codes, and octal for Unix file permissions.
Why do programmers use hexadecimal instead of binary?
Hexadecimal is a compact representation of binary data. Each hex digit represents exactly 4 binary bits, so a byte (8 bits) is always exactly 2 hex digits. Binary 11111111 becomes hex FF — much easier to read and type. Memory addresses, color codes, MAC addresses, and hash values use hex because it maintains a direct relationship to the underlying binary while being human-readable. Decimal does not map cleanly to binary boundaries, making it harder to reason about bit patterns.
How do I convert a negative number to binary?
Negative integers in computers use two's complement representation. To convert -N to binary: write the positive N in binary, flip all bits (ones' complement), then add 1. For example, -5 in 8-bit binary: 5 is 00000101, flipped is 11111010, plus 1 is 11111011. The most significant bit indicates the sign: 0 for positive, 1 for negative. Two's complement is used by virtually all modern processors because it allows the same addition circuitry to handle both positive and negative numbers.

Related Convert Tools