Number Base Converter

Convert between binary, octal, decimal, hexadecimal, and any base from 2 to 36. View binary bit patterns, ASCII mappings, and two's complement. All calculations happen locally — nothing leaves your browser.

Decimal Value
255
0xFF · 11111111 · 377
Binary
11111111
Octal
377
Hexadecimal
FF
ASCII
?
Input Number
Binary Bit Display
Two's Complement (8-bit)
11111111
All Bases
ASCII Character Mapping

What is a number base? A number base (or radix) is how many distinct digits a positional numeral system uses: base 2 uses 0-1, base 10 uses 0-9, base 16 uses 0-9 plus A-F. Every digit position carries a weight equal to the base raised to that position's index, so the hexadecimal number FF means 15×16 + 15×1 = 255 in decimal, or 11111111 in binary.

How to Use the Base Converter

  1. Type the number — Enter the value in the Number field. Only digits that are legal for the chosen base count — FF is a valid base-16 number but meaningless in base 10.
  2. Set the input base — Pick the base your number is already written in, from base 2 to base 36. Getting this wrong is the usual cause of a surprising result: 101 is 5 in binary but 257 in hexadecimal.
  3. Read every conversion at once — The hero panel shows decimal, hex, binary and octal together, and the All Bases panel lists the same value in every base from 2 to 36.
  4. Inspect the bit pattern — The bit display pads the binary form to a whole number of bytes and highlights the set bits, which makes masks, flags and permission bits easy to read off.
  5. Check the two's complement and ASCII — The 8-bit two's complement box shows how the same bit pattern would be read as a signed byte, and the ASCII panel maps values 32–126 to their printable characters.
  6. Copy the resultsCopy All Conversions puts the full set on your clipboard. The number and base are also kept in the page URL, so the link reproduces your conversion.

How Base Conversion Works

Every numeral system we use in computing is positional: the value of a digit depends on where it sits. Reading right to left, position 0 is worth b0 = 1, position 1 is worth b1, position 2 is worth b2, and so on, where b is the base. Multiplying each digit by its positional weight and adding the products gives the value:

value = dn×bn + … + d2×b2 + d1×b1 + d0×b0

So hexadecimal FF expands to 15×161 + 15×160 = 240 + 15 = 255, and binary 1101 expands to 1×8 + 1×4 + 0×2 + 1×1 = 13. Going the other way — decimal to another base — uses repeated division: divide by the base, write down the remainder, repeat with the quotient, then read the remainders bottom to top. Converting 13 to binary gives remainders 1, 0, 1, 1, which read upward as 1101.

This converter does both halves in one pass. It parses your input into an internal decimal integer, then re-renders that integer in every target base, so base 3 to base 29 is no harder than binary to hex. Digits above 9 are written as letters, which is why base 36 — ten digits plus twenty-six letters — is the practical ceiling for a single-character-per-digit alphabet.

Common Bases and Where They Show Up

BaseNameDigitsTypical use
2Binary0–1Machine words, bit flags, subnet masks, digital logic
8Octal0–7Unix file permissions (chmod 755), older assembly toolchains
10Decimal0–9Everyday arithmetic and most user-facing numbers
16Hexadecimal0–9, A–FMemory addresses, byte dumps, CSS colour codes, MAC addresses
36Base 360–9, A–ZCompact alphanumeric identifiers and short codes

Binary, octal and hexadecimal fit together neatly because 8 and 16 are powers of 2. One octal digit is exactly three bits and one hex digit is exactly four bits, so you can convert between them by grouping bits rather than doing any arithmetic: 11111111 splits into 1111 1111, which is F F. That property is the whole reason hex survives as the working notation for byte-level data — it is binary you can actually read aloud.

Two's Complement and the Signed Byte

The same bit pattern means different things depending on whether it is read as unsigned or signed. Two's complement is the near-universal way processors store negative integers: to negate a value you invert every bit and add one. In eight bits, that makes the range −128 to +127 instead of 0 to 255, and it means 11111111 is 255 when unsigned and −1 when signed. The advantage is that ordinary binary addition works unchanged for both signs, so hardware needs only one adder. The two's complement panel above shows the signed reading of whatever you enter, which is useful when a debugger prints a large unsigned number where you expected a small negative one.

Bytes, ASCII and Character Codes

Values from 0 to 127 double as ASCII character codes. The printable range runs from 32 (space) to 126 (tilde), with the uppercase letters at 65–90 and lowercase at 97–122 — exactly 32 apart, which is why flipping a single bit changes case. Codes below 32 are control characters such as tab (9) and newline (10) and have no visible glyph. The ASCII panel shows the character for any value in the printable range and reports non-printable otherwise. Beyond 127, byte values belong to a specific encoding such as UTF-8, and a single number no longer maps to a single character.

Frequently Asked Questions

Two's complement is the standard way to represent negative integers in binary. To get the two's complement of a number: invert all bits (change 0s to 1s and vice versa), then add 1. For 8-bit, 255 (11111111) is also -1 in two's complement.

Hex is a compact representation of binary. Each hex digit maps to exactly 4 bits, making it easy to read binary values. Memory addresses, color codes (#FF5733), and byte values are commonly displayed in hex.

Each binary digit represents a power of 2, starting from the rightmost bit (2^0). Multiply each bit by its power of 2 and sum all values. For example, 1101 in binary = 1×8 + 1×4 + 0×2 + 1×1 = 13 in decimal. This tool does the conversion instantly for any base between 2 and 36.

Only the number of digits available. Binary has two (0-1), octal eight (0-7), decimal ten (0-9) and hexadecimal sixteen (0-9 then A-F). The same quantity written in each looks different but is identical: 255 decimal is 11111111 binary, 377 octal and FF hexadecimal. Bases that are powers of two convert to binary by simple digit grouping, which is why octal and hex are used as shorthand for bit patterns.

It works with whole numbers held as standard double-precision values, so results are exact up to 9,007,199,254,740,991 (2^53 - 1). Above that limit the low digits can be rounded and the binary and hex output stops being trustworthy. Fractions and decimal points are not supported either — the converter is for integers only.

No. The parsing and every base conversion run in JavaScript inside your browser, so nothing is uploaded or logged. The only thing that leaves the page is what you choose to copy, plus the value stored in the URL if you share the link — so avoid pasting a shared link containing anything sensitive.

Digits that are not valid in the selected base stop the parse. Typing 1 9 0 while the base is set to 8 reads only the leading 1, because 9 is not an octal digit; typing a letter in base 10 gives nothing at all. Check that the input base matches how the number is written, and strip any prefix such as 0x or 0b before entering it.

Use binary while you are working out which individual bits are set, because the bit display lines the positions up visually. Switch to hexadecimal for writing the value down or pasting it into code — it is four times shorter, less error-prone to transcribe, and every hex digit still maps to exactly four bits, so you can expand it again at a glance.

Use Cases

Binary to Decimal

Convert binary numbers to decimal for computer science homework, digital logic design, and understanding computer architecture.

Hex Color Codes

Convert hex color codes like #FF5733 to decimal RGB values for CSS, design tools, and color manipulation tasks.

Legacy System Octal

Convert octal values to decimal when working with legacy Unix file permissions, older systems, and octal-based configurations.

IP Address Subnet Math

Perform subnet calculations for network configuration, understanding IP address ranges, and CIDR notation conversions.

Assembly Programming

Convert between number bases when working with assembly language, low-level programming, and memory address calculations.