All Tools

Number Base Converter

Convert numbers between binary, octal, decimal, and hexadecimal instantly.

Share or export a resultSelect result text in the tool below to enable these options.

Input base

Binary (base 2)

—

Octal (base 8)

—

Decimal (base 10)

—

Hexadecimal (base 16)

—

Tips & Guide

Why different number bases?

Computers store data in binary (base 2) because transistors have two states: on/off. Hexadecimal (base 16) is used by programmers as a compact representation of binary, where each hex digit represents exactly 4 bits. Decimal (base 10) is what humans naturally use.

Binary (base 2)

Only uses 0 and 1. Each digit position represents a power of 2. The binary number 1010 = (1×8) + (0×4) + (1×2) + (0×1) = 10 in decimal. Used in all digital computing at the hardware level.

Octal (base 8)

Uses digits 0–7. Each octal digit represents 3 binary bits. File permissions in Unix/Linux use octal. For example, 755 means the owner can read/write/execute (7=111), group and others can read/execute (5=101).

Hexadecimal (base 16)

Uses 0–9 and A–F (where A=10, B=11, C=12, D=13, E=14, F=15). Colors in web design are hex: #FF5733 means Red=255, Green=87, Blue=51. Memory addresses are typically shown in hex.

Converting manually

To convert decimal to binary: repeatedly divide by 2 and note the remainders. Read remainders bottom-to-top. For example, 13 ÷ 2 = 6 R1, 6 ÷ 2 = 3 R0, 3 ÷ 2 = 1 R1, 1 ÷ 2 = 0 R1 → binary is 1101.

Two's complement

Negative numbers in binary use two's complement notation. To negate a number: flip all bits, then add 1. For example, +5 in 8-bit is 00000101; -5 is 11111010 + 1 = 11111011. This makes addition circuits simpler for hardware.

Choose an input base, enter one whole integer, and view the equivalent binary, octal, decimal, and hexadecimal values. Large integers are handled without floating-point rounding.

How to use the Number Base Converter

  1. Select the base of the value you are entering.
  2. Type one whole integer in the input field. Digits must be valid for the selected base.
  3. The other three cards update to show the equivalent value.
  4. Hexadecimal uses A–F for values 10–15. A matching 0b, 0o, or 0x prefix is optional.
  5. Negative values are shown with a minus sign; this page does not encode fixed-width two's complement.
  6. Use a card's copy button to copy its value.

Examples

Decimal 255

Binary: 11111111 | Octal: 377 | Hex: FF

Hex FF

Decimal: 255 | Binary: 11111111 | Octal: 377

Binary 1010

Decimal: 10 | Octal: 12 | Hex: A

Decimal 16

Binary: 10000 | Octal: 20 | Hex: 10

How to calculate manually

Convert decimal 42 to binary

  1. Divide by 2 repeatedly and note the remainders:
  2. 42 ÷ 2 = 21 R0 | 21 ÷ 2 = 10 R1 | 10 ÷ 2 = 5 R0 | 5 ÷ 2 = 2 R1 | 2 ÷ 2 = 1 R0 | 1 ÷ 2 = 0 R1
  3. Read remainders from bottom to top: 101010

Decimal 42 = Binary 101010

Convert hex 1F to decimal

  1. 1F = (1 × 16¹) + (F × 16⁰) = 16 + 15

Hex 1F = Decimal 31

Binary is the native language of computers because transistors have exactly two stable states: on and off. Hexadecimal became popular with programmers because it compactly represents binary data — each hex digit maps exactly to 4 binary bits, making it easy to read memory addresses, colour codes, and byte values at a glance.

Sources for Number Base Converter

Frequently asked questions

What number bases are supported?

Common bases include binary (2), octal (8), decimal (10), and hexadecimal (16), with digits chosen according to the selected base. Decimal uses 0–9; hexadecimal adds A–F. Enter a value that is valid for the source base, because a digit such as 8 cannot be part of a binary or octal number.

Where are number bases used?

Binary is natural for digital logic, octal appears in some permissions and legacy notation, decimal is used for everyday quantities, and hexadecimal is compact for bytes, colours, memory addresses, and debugging. Converting the representation does not change the underlying quantity; it only changes how the same value is written.

How should I read a hexadecimal result?

Hexadecimal place values are powers of 16, and A through F represent 10 through 15. A prefix such as 0x is a programming convention rather than part of the numeric value in every context. Keep leading zeroes when the value represents a fixed-width byte, colour channel, address, or protocol field.

Why does a negative number need extra care in base conversion?

A negative value has a sign, but software may represent its magnitude or use a fixed-width two’s-complement bit pattern. Those interpretations can produce different-looking binary or hexadecimal output. Confirm the target field width and signedness before copying a converted negative value into code or a protocol.