Number Base Converter

Type a number in any field — Binary, Octal, Decimal, or Hex — and all other fields update instantly. 100% client-side.

Type a number in any field above to convert between bases.

Common Value Reference Table

Decimal Binary Octal Hex Char

How to Use the Number Base Converter

  1. Type a number into any field — Binary, Octal, Decimal, or Hex. All other fields update automatically.
  2. Enable Show Prefix to display the standard programming language prefixes: 0b for binary, 0o for octal, 0x for hex.
  3. Use the reference table below the input fields for a quick lookup of common values.
  4. Copy results using the Copy Decimal or Copy Hex buttons.

Understanding Number Bases

Every positional number system is defined by its base (also called the radix), which determines how many unique digits it uses and what value each digit position represents. In decimal (base 10), the digit positions represent powers of 10: ones (100), tens (101), hundreds (102), and so on. In binary (base 2), positions represent powers of 2: 1, 2, 4, 8, 16, 32, 64, 128. All number systems ultimately represent the same values — they just use different notation.

Binary (Base 2)

Binary uses only the digits 0 and 1. It is the language of computers because electronic circuits have two states: on (represented as 1) and off (represented as 0). Every piece of digital data — text, images, programs — is ultimately stored as binary. Binary numbers can be long: the decimal number 255 requires 8 binary digits (11111111). The 8-bit group (one byte) is the fundamental unit of computer memory.

Octal (Base 8)

Octal uses the digits 0 through 7. Each octal digit represents exactly 3 binary digits, making it a compact shorthand for binary. Octal was popular in early computing and is still used in Unix/Linux file permissions (e.g., chmod 755, where 7 = 111 in binary = read+write+execute, 5 = 101 = read+execute). In modern programming, octal literals are written with a 0o prefix in Python and JavaScript.

Hexadecimal (Base 16)

Hexadecimal uses the digits 0-9 and the letters A-F (representing values 10-15). Each hex digit represents exactly 4 binary digits (one nibble), so a byte (8 bits) is always exactly 2 hex digits. This makes hex extremely compact for representing binary data. Hex is ubiquitous in programming: color codes (#FF5733), memory addresses (0x7FFE1234), cryptographic hashes (SHA256 is 64 hex chars), and binary file formats all use hexadecimal notation.

Conversion Examples

Here are some landmark values across all four bases:

  • Decimal 255 = Binary 11111111 = Octal 377 = Hex FF (maximum value of one byte)
  • Decimal 256 = Binary 100000000 = Octal 400 = Hex 100 (one more than one byte)
  • Decimal 65535 = Binary 1111111111111111 = Octal 177777 = Hex FFFF (maximum 16-bit unsigned integer)
  • Decimal 65536 = Binary 10000000000000000 = Octal 200000 = Hex 10000

For converting text characters to their numeric codes and then to hex or binary, combine this tool with our Hex ↔ ASCII Converter and Binary ↔ Text Converter.

Frequently Asked Questions

A number base (or radix) determines how many unique digits a number system uses. Decimal (base 10) uses 10 digits (0-9), binary (base 2) uses 2 digits (0 and 1), octal (base 8) uses 8 digits (0-7), and hexadecimal (base 16) uses 16 symbols (0-9 and A-F). All these systems represent the same numbers in different notations.
Computers use binary because electronic circuits naturally have two states: on (1) and off (0). Representing data with just two states is simple, reliable, and immune to small variations in voltage. Every piece of data a computer processes — text, images, videos, programs — is ultimately stored and manipulated as sequences of 0s and 1s.
Hexadecimal is used because it is a compact way to represent binary data. Since 16 = 2^4, each hexadecimal digit represents exactly 4 binary digits, and a byte (8 bits) is always exactly two hex digits. This makes it much easier to read and write binary values. Hex is used for memory addresses, color codes, cryptographic hashes, and binary protocols.
To convert decimal to binary, repeatedly divide the number by 2, writing down the remainder each time, until the quotient reaches 0. Then read the remainders from bottom to top. For example, 13 divided by 2 gives 6 R1, then 3 R0, then 1 R1, then 0 R1. Reading upward: 1101. Just type a decimal number in the Decimal field here and the binary result appears instantly.
These prefixes are used in programming languages to indicate number base: 0b means binary (0b1101 = 13), 0o means octal (0o15 = 13), and 0x means hexadecimal (0xD = 13). Enable the "Show Prefix" chip in this converter to add these prefixes to the output fields.