Number Base Converter

Convert between binary, octal, decimal, and hexadecimal

What Is a Number Base?

A number base — also called a radix — is the number of unique digits a system uses to represent values. You use decimal (base 10) every day, but computers think in binary (base 2), and programmers constantly move between binary, octal, decimal, and hexadecimal depending on the task. A number base converter translates a single value between all of these systems so you do not have to do the arithmetic by hand.

The same quantity has a different shape in every base. Decimal 255 is 11111111 in binary, 377 in octal, and FF in hexadecimal — all identical values, just written with different digit sets. Understanding how they relate is core to bit manipulation, low-level debugging, networking, and reading raw data.

This tool converts your input to all four bases at once and also reports how many bits and bytes the value occupies, plus a grouped binary view that splits the bits into readable 4-bit nibbles.

How to Use This Number Base Converter

  1. Choose the input base in the From selector — Binary (2), Octal (8), Decimal (10), or Hexadecimal (16).
  2. Type or paste your number. Prefixes like 0b, 0o, and 0x are stripped automatically, so pasting a code literal such as 0xDEADBEEF works as-is.
  3. Read every base instantly. Output updates as you type and with Ctrl+Enter; the copy button grabs the full result, and Ctrl+L clears the workspace.

The output block shows binary (with and without 4-bit grouping), octal, decimal, and uppercase hexadecimal, followed by the bit length and byte count — handy when you need to know whether a value fits in 8, 16, or 32 bits.

How to Convert Binary to Decimal (Step by Step)

Binary uses only 0 and 1, and each position is a power of two. Reading right to left, the place values are 1, 2, 4, 8, 16, 32, 64, 128, and so on. To convert, multiply each digit by its place value and sum them:

Binary:   1  0  1  1  0  1  0
Place:   64 32 16  8  4  2  1
Value:   64 +0 +16 +8 +0 +2 +0  =  90

So 1011010 equals decimal 90. The tool does this for you the moment you select Binary as the input base — but knowing the method helps you sanity-check results and answer interview questions.

How to Convert Decimal to Binary (Step by Step)

Go the other way with repeated division by 2, recording each remainder, then read the remainders bottom to top:

90 ÷ 2 = 45  remainder 0
45 ÷ 2 = 22  remainder 1
22 ÷ 2 = 11  remainder 0
11 ÷ 2 =  5  remainder 1
 5 ÷ 2 =  2  remainder 1
 2 ÷ 2 =  1  remainder 0
 1 ÷ 2 =  0  remainder 1   → read up: 1011010

The same divide-and-collect-remainders trick works for any target base — divide by 8 for octal or 16 for hexadecimal.

Hex and Octal Shortcuts

Because 16 and 8 are both powers of two, hex and octal convert to binary without any arithmetic:

  • Hex ↔ binary: each hex digit is exactly 4 bits (a nibble). F = 1111, A = 1010, so 0xFA = 1111 1010.
  • Octal ↔ binary: each octal digit is exactly 3 bits. 7 = 111, so octal 0o75 = 111 101.

That nibble/triplet mapping is why the grouped-binary output is so useful — you can read the hex value straight off the 4-bit groups.

Number Base Reference Table

BaseNameDigitsPrefixCommon use
2Binary0-10bBit manipulation, flags, hardware
8Octal0-70oUnix file permissions (chmod 755)
10Decimal0-9—Everyday math, most APIs
16Hexadecimal0-9, A-F0xColors, memory addresses, byte dumps
DecimalBinaryOctalHex
81000108
10101012A
15111117F
16100002010
64100000010040
25511111111377FF
256100000000400100

Common Errors and Limitations

  • Invalid digit for the base. A 2 in a binary number, an 8 in octal, or a G in hex is not a legal digit, and the tool reports “Invalid number for base N”. Double-check you selected the right From base.
  • Large-number precision. JavaScript represents numbers as 64-bit floats, so integers above 9,007,199,254,740,991 (2⁵³−1) can round. For 64-bit register values, checksums, or crypto material, use a BigInt-based conversion in code instead.
  • No fractional or negative parts. This is an integer converter. Values with a decimal point (3.14) or a sign are outside its scope; convert the integer part only.
  • Leading zeros are dropped. 00001010 and 1010 produce the same result, since leading zeros carry no value. Use the bit-count field if you need to reason about a fixed width.

Common Use Cases

  • Bitwise programming — verify masks and flags by seeing the exact bit pattern behind a hex constant like 0x1F.
  • File permissions — Unix chmod modes are octal; convert 755 or 644 to binary to read the read/write/execute bits directly, or pair this with the chmod calculator.
  • Colors and memory — hex color codes and pointer addresses are base 16; convert them to decimal for calculations or to binary to inspect individual channels.
  • Networking — subnet masks and IP octets are easiest to reason about in binary.
  • Debugging and CTFs — quickly decode a value you found in a hex dump, register, or wire capture.

Number Base Converter vs Language Built-ins

Most languages can convert bases in code — parseInt("FF", 16) and (255).toString(2) in JavaScript, int("FF", 16), bin(), oct(), and hex() in Python, or printf "%x" in the shell. Those are perfect inside a program, but when you just need a quick answer you would otherwise open a REPL, remember the exact call, and read past the 0b/0x prefix. This converter gives you all four bases plus bit and byte counts in one glance, with nothing to install and no data leaving your browser — the fastest path when you are reading a spec, a diff, or a stack trace and simply need to know what a number is.

Frequently Asked Questions

What is a number base?

A number base (or radix) is how many unique digits a number system uses. Binary is base 2 (digits 0-1), octal is base 8 (0-7), decimal is base 10 (0-9), and hexadecimal is base 16 (0-9 plus A-F). The same value looks completely different in each base — decimal 255 is 11111111 in binary and FF in hex.

How do I convert binary to decimal?

Multiply each binary digit by its place value (a power of 2) and add the results. Reading right to left, the places are 1, 2, 4, 8, 16, 32… For 1010: (1×8) + (0×4) + (1×2) + (0×1) = 10. This tool does it instantly — set 'From' to Binary and paste the value.

How do I convert decimal to binary?

Repeatedly divide the number by 2 and record each remainder, then read the remainders bottom to top. For 13: 13÷2=6 r1, 6÷2=3 r0, 3÷2=1 r1, 1÷2=0 r1 → 1101. Or just set 'From' to Decimal here and read the binary output.

What do the 0b, 0o, and 0x prefixes mean?

They are language prefixes that mark the base of a literal: 0b for binary, 0o for octal, and 0x for hexadecimal (0d or no prefix for decimal). This converter strips them automatically, so you can paste code literals like 0xFF or 0b1010 directly without editing them out first.

Why is hexadecimal used in programming?

Hex is compact — one hex digit maps to exactly four binary digits (a nibble) — so a full byte is just two hex characters. That makes it the natural notation for memory addresses, color codes (#FF8800), byte dumps, and bitmasks, where raw binary would be long and error-prone.

Can it convert very large numbers or decimals with a fractional part?

It converts positive integers. Values above 9,007,199,254,740,991 (2⁵³−1) may lose precision because JavaScript uses double-precision floats, and fractional inputs like 3.14 are not supported. For arbitrary-precision or fixed-point work, use a language BigInt type instead.

Is my data safe?

Yes. Every conversion runs entirely in your browser using plain JavaScript. Nothing you type is uploaded, logged, or sent to any server, so it is safe for addresses, keys, or values from private systems.