Categories

Number Conversion

Convert between decimal, binary, octal, and hexadecimal

Number Base Converter — Binary, Decimal, Octal, Hex

This free number base converter translates values between decimal (base 10), binary (base 2), octal (base 8), and hexadecimal (base 16), showing all four bases at once from a single input. It is a staple for programmers reading bit flags and memory addresses, students learning positional number systems, and anyone decoding file permissions or color values.

Conversion uses JavaScript BigInt, so it keeps full precision for 64-bit values, hashes, and IDs that would silently corrupt in tools built on floating-point numbers. It accepts optional 0x, 0b, and 0o prefixes and runs entirely in your browser.

How to use Number Conversion

  1. Choose the Input base — the base your number is currently in (decimal, binary, octal, or hexadecimal).
  2. Type or paste the number into the input box; an optional 0x, 0b, or 0o prefix is accepted.
  3. All four bases appear instantly, each with a copy button. Invalid digits for the selected base show a clear error.

The four bases at a glance

All positional number systems encode the same values with different digit sets. The number forty-two, for example, is 42 in decimal, 101010 in binary, 52 in octal, and 2A in hexadecimal.

  • Decimal (base 10) — digits 0–9; the everyday human number system.
  • Binary (base 2) — digits 0–1; the native language of computers, where each digit is one bit.
  • Octal (base 8) — digits 0–7; three bits per digit, familiar from Unix file permissions such as 755.
  • Hexadecimal (base 16) — digits 0–9 and A–F; four bits per digit, used for memory addresses, byte dumps, and CSS colors like #FF8800.

Related terminology

Radix / base
The number of distinct digits a positional system uses; each position represents a power of the radix.
Bit and nibble
A bit is one binary digit; a nibble is four bits, which is exactly one hexadecimal digit — why hex is a compact way to write binary.
Most/least significant digit
The digit with the greatest (leftmost) or smallest (rightmost) positional value in a number.

Frequently asked questions

How do I convert decimal to binary?
Set Input Format to Decimal and Output Format to Binary, type the number, and press Process. For example 42 converts to 101010.
Why is hexadecimal so common in programming?
Each hex digit maps to exactly four binary bits, so a byte is always two hex digits. That makes hex a compact, lossless shorthand for binary data — the reason memory addresses, hashes, and colors use it.
What happens if I enter digits that are invalid for the selected base?
The input is checked against the selected base's digit set when you press Process — binary accepts only 0 and 1, octal 0–7, and hexadecimal 0–9 plus A–F — and an invalid number produces a clear error message instead of a wrong conversion.
Does the converter handle negative numbers?
Yes for decimal input — the sign is preserved through conversion. Note it converts the magnitude rather than producing two's-complement bit patterns.

Related tools