Number Base Converter

Your data never leaves your browser

Convert numbers between binary, octal, decimal, and hexadecimal instantly. Supports arbitrarily large integers.

Input base:
Enter a number above to see all base conversions
base 2base 8base 10base 16
Ctrl+KClearHover a row to copy

Share this tool

Found it useful? Help a fellow developer discover it.

https://developertoolkit.dev/tools/base-converter

Number bases at a glance

BaseNameDigitsPrefixCommon use
2Binary0–10bBitwise ops, hardware, flags
8Octal0–70oUnix permissions (chmod 755)
10Decimal0–9-General-purpose arithmetic
16Hexadecimal0–9, A–F0xMemory addresses, colors, bytes

Why developers use multiple bases

Binary (base 2) maps directly to hardware, each digit is a single bit. Because binary numbers are verbose, hexadecimal (base 16) is used as a compact shorthand: every hex digit represents exactly four bits, so a byte is always two hex digits (00–FF). This makes hex ideal for memory addresses, color codes, and byte-level debugging. Octal (base 8) was common on older Unix systems where each digit represents three bits, you still see it in Unix file permission masks (755, 644) and some assembly languages. Decimal is what humans naturally use and is the default in most high-level languages.

How to convert between number bases online

  1. Type your number in any field. Click the input for binary, octal, decimal, or hexadecimal and type your value. All other fields update instantly.
  2. Use the prefix guide. Binary values use the 0b prefix in JavaScript, hexadecimal uses 0x, and octal uses 0o. This tool accepts both plain numbers and prefixed values.
  3. Convert hex color channels. A CSS hex color like #3B82F6 is three bytes: R = 0x3B (59 decimal), G = 0x82 (130 decimal), B = 0xF6 (246 decimal). Enter each byte separately to inspect its decimal and binary representation.
  4. Read Unix permissions. Enter 755 or 644 into the octal field to see the binary representation. Each octal digit maps to 3 bits: 7 = 111 (rwx), 5 = 101 (r.x), 4 = 100 (r..).

Frequently Asked Questions

How do I convert binary to hexadecimal by hand?

Group the binary digits from the right into groups of 4. Each group of 4 bits maps directly to one hex digit: 0000=0, 0001=1, …, 1010=A, 1011=B, 1100=C, 1101=D, 1110=E, 1111=F. For example, 11111111 binary splits into 1111 1111, which is FF in hex.

Why are Unix file permissions written in octal?

Unix permissions have 3 groups of 3 bits (rwx for owner, group, and other). Three bits fit neatly into one octal digit (0–7), so the full 9-bit mask is expressed as 3 octal digits. For example, rwxr-xr-x = 111 101 101 = 755 in octal.

What is the largest number this tool can handle?

This tool uses JavaScript's BigInt for arbitrary-precision arithmetic, so there's no practical upper limit. You can convert numbers with thousands of digits.

Does the tool support negative numbers?

Yes. Prefix your input with a minus sign (for example .255). The tool converts the absolute value and applies the sign to all outputs. It does not use two's complement notation.

How do I convert decimal to binary online?

Type your decimal number into the decimal field and the binary equivalent appears instantly. For example, 255 in decimal is 11111111 in binary. The algorithm divides by 2 repeatedly and reads the remainders from bottom to top. This tool uses JavaScript BigInt so you can convert arbitrarily large numbers without overflow.

What does the 0x prefix mean in hexadecimal?

0x is a prefix used in C, C++, JavaScript, Python, Go, and most other languages to indicate a hexadecimal number. For example, 0xFF equals 255 in decimal. The prefix is not part of the numeric value, it is a notation convention. Similarly, 0b is used for binary and 0o for octal in most modern languages.

How do I convert hex to decimal by hand?

Multiply each hex digit by 16 raised to its position from the right (starting at 0). For example, 0x3B: B is decimal 11, times 16 to the power 0 = 11. Then 3 times 16 to the power 1 = 48. Total: 11 + 48 = 59. For quick lookup: A=10, B=11, C=12, D=13, E=14, F=15.

Why is hexadecimal used for memory addresses?

Memory addresses and byte values are inherently binary. Hexadecimal is a compact shorthand: every 4 binary bits map to exactly one hex digit, so a 32-bit address is exactly 8 hex digits. The same address in binary would be 32 characters long. Hex stays close to the underlying binary representation while remaining compact enough to read.

Related Tools