◆ Online Dev Kit

Number Base Converter

Binary ↔ Octal ↔ Decimal ↔ Hex, live.

About this tool

Convert a number between the four common bases used in programming: binary (base 2), octal (base 8), decimal (base 10) and hexadecimal (base 16). Pick the base of your input and see all representations at once. Runs entirely in your browser.

Common use cases

How it works

Number base conversion works by repeatedly dividing the number by the target base and collecting remainders, or by converting through an intermediate base (usually decimal). Each digit position represents a power of the base: the rightmost digit is base^0, next is base^1, etc. Binary (base 2) uses digits 0-1, octal (base 8) uses 0-7, decimal (base 10) uses 0-9, and hexadecimal (base 16) uses 0-9 and A-F. The converter parses the input in its source base, converts to an internal numeric value, then formats the output in the target base.

FAQ

Can I paste a hex value with 0x?

Yes — a leading 0x is stripped automatically when the input base is Hex.

What's the max size?

Standard JavaScript number precision (up to 2^53). For larger values use a big-integer tool.

Why do programmers use hexadecimal?

Hexadecimal (base 16) is a compact way to represent binary numbers. Each hex digit represents exactly 4 binary digits (bits), making it easy to read and write byte values. For example, 11111111 in binary is FF in hex.

What is the maximum value for N bits?

An N-bit unsigned integer can represent values from 0 to 2^N - 1. For example, 8 bits = 0-255, 16 bits = 0-65535, 32 bits = 0-4294967295.