Home/Developer Tools/Number Base Converter
🔢

Number Base Converter

FREE

Convert between binary, decimal, hex, octal and text

Free · No sign-up required
Loading...

What the number base converter does

The converter takes a value in binary, decimal, hexadecimal or octal and shows it in all the others at once. It also converts text to and from binary — each character to its 8-bit code — which is handy for teaching, puzzles and checking encodings. Enter a value, choose which base it is in, and read off the rest. Everything runs in your browser.

The four bases

BaseDigitsPrefix in codeWhere you see it
Binary (2)0 10b1010Bit flags, subnet masks, hardware registers
Octal (8)0–70o755 or 0755Unix file permissions
Decimal (10)0–9noneEveryday numbers
Hexadecimal (16)0–9 A–F0x1F or #1FColours, memory addresses, hashes, MAC addresses, bytes

Hex and octal are popular because they line up with binary exactly: one hex digit is four bits, one octal digit is three. Converting between them is a matter of grouping digits, no arithmetic required.

Converting by hand

Decimal 202 → binary: divide by 2, read remainders bottom-up 202 ÷ 2 = 101 r 0 101 ÷ 2 = 50 r 1 50 ÷ 2 = 25 r 0 25 ÷ 2 = 12 r 1 12 ÷ 2 = 6 r 0 6 ÷ 2 = 3 r 0 3 ÷ 2 = 1 r 1 1 ÷ 2 = 0 r 1 → 11001010 Binary 11001010 → hex: group in fours from the right 1100 1010 → C A → 0xCA Binary 11001010 → octal: group in threes from the right 011 001 010 → 3 1 2 → 0o312 Hex 0xCA → decimal: 12 × 16 + 10 = 202

Useful values to recognise

DecimalBinaryHexMeaning
25511111111FFMax unsigned byte; one octet of an IP address
2561 000000001002⁸
1024100 000000004002¹⁰ — one kibibyte
6553516 onesFFFFMax 16-bit unsigned; highest port number
429496729532 onesFFFFFFFFMax 32-bit unsigned; 255.255.255.255
127011111117FMax signed byte; last ASCII code
-1 (8-bit two's complement)11111111FFSame bits as 255 — sign is interpretation

Text to binary

Each character has a code point; ASCII covers 0–127 and UTF-8 extends it. The converter shows one byte per ASCII character as eight bits:

"Hi" → 01001000 01101001 H = 72 = 0x48 i = 105 = 0x69

Characters outside ASCII (accented letters, Thai, emoji) take two to four bytes in UTF-8, so a single character may appear as several groups of eight bits. Converting binary back to text assumes the same encoding.

Where each base turns up in practice

  • Colours: #E85D26 is three hex bytes — red 232, green 93, blue 38.
  • File permissions: chmod 755 is octal for rwxr-xr-x — 111 101 101 in binary.
  • Subnet masks: 255.255.255.0 is 24 ones followed by 8 zeros, hence /24.
  • Bit flags: options combined with OR, checked with AND — read them in binary to see which are set.
  • Hashes and IDs: SHA-256 output, UUIDs and MAC addresses are hex because it is compact and byte-aligned.
  • Memory and debugging: addresses, opcodes and register dumps are shown in hex.

Frequently asked questions

Are letters in hex case-sensitive?

No. 0xff and 0xFF are the same value. Conventions vary: CSS often uses lowercase, assembly and documentation often uppercase.

How are negative numbers handled?

The converter treats input as unsigned. Negative values in computers use two's complement, where the bit pattern depends on the width (8, 16, 32 or 64 bits); a bitwise calculator with a width setting is the right tool for that.

How big a number can I convert?

Arbitrarily large integers are supported. Fractions are not — the tool works with whole numbers.

Why is 0.1 not exact in binary?

Just as 1/3 has no finite decimal expansion, 1/10 has no finite binary expansion. That is why floating-point sums like 0.1 + 0.2 give 0.30000000000000004.

What is base64 — is it a number base?

It is a way of encoding bytes as 64 printable characters, not a positional number system for arithmetic. Use the Base64 encoder for that.

Is anything sent to a server?

No. Conversion runs in your browser.

More tools in this category

🔐
Base64 Encoder & Decoder
Encode and decode text in Base64 format
🔢
Word Counter
Count characters, words, sentences, paragraphs and lines
📄
Lorem Ipsum Generator
Generate placeholder words, sentences or paragraphs
📋
JSON Tools
View tree, format, validate and minify JSON
📄
YAML Beautifier & Validator
Format YAML and find the line that breaks it
📋
XML Tools
Beautify, validate and convert XML to JSON