Number Base Converter

Convert a number between binary, octal, decimal and hexadecimal - or any base from 2 to 36. Useful for reading bitmasks, decoding colour values, working with file permissions and making sense of memory addresses.

Free · runs in your browser · updated

Decimal (Base 10)
Binary (Base 2)
Octal (Base 8)
Hexadecimal (Base 16)

Number Base Converter at a glance

What it does
Convert numbers between binary, octal, decimal, hexadecimal and any base from 2 to 36, with an explanation of how positional notation
Where it runs
Entirely in your browser — no data is uploaded
Works offline
Yes, once the page has loaded
Cost
Free, with no account and no usage limit
Category
Converters

How to use the converter

  1. Enter your number and state which base it is currently in.
  2. Read the equivalents in every other base at once.
  3. Copy whichever representation you need.

The four bases you will actually meet

BaseDigitsPrefixWhere it appears
Binary (2)0-10bBit flags, permissions, network masks, low-level hardware.
Octal (8)0-70oUnix file permissions - chmod 755 is octal.
Decimal (10)0-9noneEverything humans do.
Hexadecimal (16)0-9, A-F0xColours, memory addresses, byte values, hashes, MAC addresses.

Why hexadecimal is everywhere

Because one hex digit is exactly four bits, and two hex digits are exactly one byte. That correspondence makes hex a compact, lossless shorthand for binary that humans can actually read.

The colour #FF5733 is three bytes: red 255, green 87, blue 51. A 32-bit memory address fits in eight hex digits instead of thirty-two ones and zeros. A SHA-256 hash is 64 hex characters rather than 256 binary digits. Converting between hex and binary requires no arithmetic at all - you substitute each digit for its four-bit pattern.

Octal survives mainly in Unix permissions, where three bits map neatly onto read, write and execute: 7 is 111, all three; 5 is 101, read and execute; 6 is 110, read and write.

How conversion works

Positional notation means each digit's value is the digit multiplied by the base raised to the position. Reading 1101 in binary from the right:

1×2³ + 1×2² + 0×2¹ + 1×2⁰
  8  +   4  +   0  +   1  = 13

Going the other way, divide repeatedly by the base and collect the remainders, reading them from last to first:

13 ÷ 2 = 6 remainder 1
 6 ÷ 2 = 3 remainder 0
 3 ÷ 2 = 1 remainder 1
 1 ÷ 2 = 0 remainder 1   →  1101

Where this comes up in practice

  • Colours. #FFFFFF is white because each channel is at its maximum of 255. The colour converter handles the RGB and HSL forms.
  • File permissions. chmod 644 means owner read+write, group and others read only.
  • Bit flags. Packing eight boolean options into one byte, then testing them with bitwise AND.
  • Subnet masks. 255.255.255.0 is /24 because the first 24 bits are ones.
  • Character codes. Unicode code points are conventionally written as U+00E9 - hexadecimal.
  • Debugging binary data. A hex dump is the standard way to inspect a file format or a network packet.

Bit flags and masks

The most common reason to think in binary is packing several boolean options into one number. Each bit position represents one flag, so eight independent settings fit in a single byte.

READ    = 1   // 0001
WRITE   = 2   // 0010
EXECUTE = 4   // 0100
DELETE  = 8   // 1000

permissions = READ | WRITE        // 3, or 0011
canWrite    = permissions & WRITE // 2, truthy
permissions = permissions & ~WRITE // remove WRITE, back to 1

You meet this pattern in file permissions, feature flags, event listener options and hardware registers. It is compact and fast, and it is why so many APIs take a single integer where you might expect a list of booleans — converting that integer to binary is the quickest way to see which options are actually set.

Subnet masks in binary

Network addressing only makes sense in binary. A mask of 255.255.255.0 is twenty-four ones followed by eight zeros, which is why it is written as /24. The ones mark the network portion of the address and the zeros mark the host portion.

That tells you the size of the network directly: eight host bits give 28 = 256 addresses, of which 254 are usable once the network and broadcast addresses are reserved. A /26 has six host bits, so 64 addresses and 62 usable hosts.

Converting the mask to binary is also the fastest way to check whether two addresses are on the same subnet: apply the mask to both and compare the results.

Frequently asked questions

Base 16 needs sixteen distinct digit symbols and we only have ten numerals, so A through F stand for ten through fifteen. Case does not matter: 0xFF and 0xff are the same value.

Prefixes marking the base, so a reader or a compiler knows how to interpret the digits. 0x1F is 31 in hex; 0b11111 is the same number in binary. Without a prefix, 11 is genuinely ambiguous.

It handles whole numbers. Negative values in computing are usually stored as two's complement, which depends on the bit width, and fractional binary is a separate topic - floating point representation.

36, using the digits 0-9 followed by A-Z. Beyond that there are no conventional single-character digits.

Nothing you enter here leaves your browser

Number Base Converter does its work in JavaScript running on your own device. The page loads once, and after that there is no upload step and no server involved — which matters here because exported data frequently contains customer records or transactions.

You can verify this rather than taking our word for it: load the page, disconnect from the internet, and the tool keeps working. Our privacy policy sets out what is and is not collected, and this guide explains why the distinction matters.