The tool you need, ready to use

Number Base Converter

255 is 1111 1111 in binary, 377 in octal and FF in hexadecimal. Type a number into any of the five fields and the other bases update at once; negative numbers appear as two's complement patterns on the bit board, and fractions like 0.1 show their repeating digits. The division ladder and place-value steps show how each conversion works.

Last updated 2026-10-22All math stays in your browser
Examples

Bit boardTap a cell to flip that bit between 0 and 1

    Steps

    Last updated 2026-10-22Your inputs are not stored

    ROBERIN standardThe tool you need,
    ready to use.
    • Clear at a glanceInputs and results sit where you expect them.
    • Result firstThe key number comes first; the working only when you need it.
    • Ask lessNo sign-up and no unnecessary details.

    A number base is just how many digits you use to write the same number

    A number base (or radix) is the count of different digits used in each position. Decimal uses ten digits, 0–9, and each step to the left is worth 10 times more. Binary uses two, 0 and 1, and each step is worth twice as much. So 255 takes three digits in decimal, eight in binary (1111 1111) and just two in hexadecimal (FF). The value is the same; only the way of writing it changes.

    This converter puts binary, octal, decimal and hexadecimal fields next to a field for any base from 2 to 36, and retypes all the others as soon as you edit one. It handles negative numbers, fractions and numbers up to 1,000 digits without rounding, and it marks the repeating part of a binary fraction in parentheses. The bit board and the steps below show how a computer stores the number and how you would convert it by hand.

    When you need to switch bases

    People count in decimal, but a computer stores every value as bits, 0s and 1s. Long strings of bits are hard to read, so programmers write four bits as one hexadecimal digit, or three bits as one octal digit. That is why you move between bases in situations like these.

    • Color codes: the CSS color #1E90FF gives the red, green and blue levels as two hex digits each. 00 is the weakest and FF (255 in decimal) the strongest; 1E is 30 and 90 is 144.
    • File permissions: in the Linux command chmod 755 each digit is octal, and its three binary digits switch read (4), write (2) and execute (1) on or off. 7 is 111, so read, write and execute are all on; 5 is 101, so only write is off.
    • Networking: each of the four parts of the subnet mask 255.255.255.0 is 8 bits, so in binary it is 24 ones followed by 8 zeros. That is why the same mask is shortened to /24.
    • Memory and bytes: one byte (8 bits) fits exactly into two hex digits (00–FF). This is why memory addresses, hashes and file contents are usually shown in hex.
    • Reading negative numbers: a computer does not store −5 as a sign plus 5. With 8 bits it stores a two's complement pattern such as 1111 1011. If you see FB in a log, you need the width and the signedness to tell whether it means −5 or 251.
    • Decimal rounding errors: 0.1 never ends in binary, so a computer stores the nearest value it can. That is why 0.1 + 0.2 in JavaScript gives 0.30000000000000004 instead of 0.3.
    • Math homework: writing and converting numbers in base 5 or base 3 is done with division and place values. The steps panel shows exactly that process.

    How to use it

    1. Type the number into the field for the base it is written in. For hex FF use the hexadecimal field; for binary 1010 use the binary field. The other fields update immediately.
    2. For another base such as 3, 5 or 36, choose the base (2–36) at the left of the fifth field, then type the number.
    3. Put a − in front of a negative number and write the decimal point as a period (.). A repeating fraction takes its repeating digits in parentheses, as in 0.1(6). The prefixes 0x, 0b and 0o, and digits grouped with spaces or underscores (_), can be typed as they are.
    4. On the bit board, pick a width (8, 16, 32 or 64 bits) to see the two's complement and hex patterns for that width. Tapping a cell flips only that bit and puts the new value into the fields above.
    5. In the steps panel, choose the target base to see the division ladder and the place-value sum. The copy buttons copy the bare value without group spaces, and Copy link builds an address that reopens the current value.

    The digits each base uses

    Bases above 10 use letters starting from 10: A is 10, F is 15 and Z is 35, so the letters take you up to base 36. Python's int() and JavaScript's toString() also accept bases 2 to 36. Upper- and lowercase letters mean the same digit.

    The same value, 255, written in each base
    BaseDigits255Code prefixWhere you see it
    Binary (2)0, 11111 11110bBits, flags, masks
    Octal (8)0–73770oFile permissions
    Decimal (10)0–9255noneEveryday numbers
    Hex (16)0–9, A–FFF0xColors, memory, hashes
    Base 360–9, A–Z73noneShort IDs

    Base n to decimal: multiply by place values and add

    Starting from the rightmost digit, multiply the digits by n⁰, n¹, n², … in turn and add everything up. Hex 1ED is 1 × 16² + 14 × 16¹ + 13 × 16⁰ = 256 + 224 + 13 = 493. Digits after the point are multiplied by n⁻¹, n⁻², …, so binary 0.101 is 1/2 + 0/4 + 1/8 = 0.625.

    Expanding hex 1ED by place value
    Position16²16¹16⁰Sum
    Digit1E (14)D (13)
    Place value256161
    Digit × place value25622413493

    Decimal to base n: divide the integer part, multiply the fraction

    For the integer part, divide by n and write the remainder beside each step, then divide the quotient by n again. Stop when the quotient is smaller than n, and read the remainders from the last quotient upward. This is the division ladder taught in school, and the steps panel above draws it in the same shape.

    13 in binary: start from the last quotient, 1, and read the remainders upward to get 1101
    DivisionQuotientRemainder
    13 ÷ 261
    6 ÷ 230
    3 ÷ 211
    Read upward1101

    The fractional part goes the other way: multiply by n. Write down the integer part of the product, then multiply the remaining fraction by n again, until the fraction reaches 0. 0.625 × 2 = 1.25 gives 1, 0.25 × 2 = 0.5 gives 0, and 0.5 × 2 = 1 gives 1. Reading the digits from top to bottom gives 0.101.

    Fractions that never end in binary

    Write the fraction in lowest terms. If every prime factor of the denominator is also a prime factor of the base, the expansion ends; if even one is not, the same digits repeat forever. The only prime factor of 2 is 2, so 0.5, 0.25 and 0.125, whose denominators are powers of 2, end. But 0.1 = 1/10 has a 5 in the denominator, so 0011 repeats forever, as in 0.0(0011). It is the same reason 1/3 never ends as 0.333… in decimal.

    The digits in parentheses repeat forever
    DecimalFractionBinaryHex
    0.51/20.10.8
    0.251/40.010.4
    0.1251/80.0010.2
    0.753/40.110.C
    0.11/100.0(0011)0.1(9)
    0.21/50.(0011)0.(3)
    0.33/100.0(1001)0.4(C)
    0.(3)1/30.(01)0.(5)

    A computer's floating-point number (IEEE 754 double precision) rounds to 53 significant binary digits, so 0.1 is stored not as exactly 1/10 but as 0.1000000000000000055511151231257827021181583404541015625. That is why adding 0.1 three times does not give exactly 0.3. This tool keeps values as fractions, so it shows the repeating part with no rounding at all.

    Binary to octal and hex: group the digits

    Since 16 is 2⁴ and 8 is 2³, grouping binary digits in fours from the right gives one hex digit each, and grouping them in threes gives one octal digit each. You do not need to go through decimal. For example, 1 1110 1101 padded with zeros is 0001 1110 1101, which reads 1·E·D, that is hex 1ED; grouped in threes it is 111 101 101, which is octal 755.

    Four binary digits and one hex digit
    BinaryHexBinaryHexBinaryHexBinaryHex
    0000001004100081100C
    0001101015100191101D
    00102011061010A1110E
    00113011171011B1111F

    Negative numbers and two's complement

    The fields above write a negative number as a sign and a magnitude, like −5. A computer's integer variable has no separate sign, though; it stores two's complement. Flip every bit of the positive pattern and add 1, and you get the negative of the same size. In 8 bits, 5 is 0000 0101; flipping the bits gives 1111 1010, and adding 1 gives 1111 1011 (hex FB), which is −5. If the leftmost bit is 1, the number is read as negative; read the same 1111 1011 as unsigned and it is 251.

    One 8-bit pattern read in two ways
    8-bit patternHexUnsignedTwo's complement
    0111 11117F127127
    0000 00010111
    0000 00000000
    1111 1111FF255−1
    1111 1011FB251−5
    1000 000080128−128
    Integers each bit width can hold (the same ranges as Java's integer types)
    WidthUnsignedTwo's complementJava type
    8 bits0 ~ 255−128 ~ 127byte
    16 bits0 ~ 65,535−32,768 ~ 32,767short
    32 bits0 ~ 4,294,967,295−2,147,483,648 ~ 2,147,483,647int
    64 bits0 ~ 18,446,744,073,709,551,615−9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807long

    If a value does not fit in the chosen width, the upper bits are cut off. Put 300 into 8 bits and only the lower eight bits, 0010 1100, remain, which is 44. Choose width 8 on the bit board to see the truncated pattern together with a warning.

    Common mistakes

    • Typing into the wrong base: 1010 in the decimal field is one thousand and ten; it is ten only when typed into the binary field. The same digits mean completely different values depending on the base you read them in.
    • Putting a prefix in the wrong field: 0x means hexadecimal, so the decimal field cannot read it. In that case the tool shows a button that moves the number to the hexadecimal field.
    • Letter O versus zero, lowercase l versus one: O is the digit 24 and L is the digit 21, so they exist only in base 25 and base 22 or higher. Hex has only A–F.
    • Using a comma as the decimal point: this tool and programming languages write the decimal point as a period. A comma is read only as a thousands separator in the decimal field, as in 1,024.
    • Leading zeros: 0755 and 755 are the same number. In C code, however, an integer starting with 0 is read as octal, so do not put a leading 0 in front of a decimal number.
    • Reading two's complement without a width: FB is −5 in 8-bit two's complement, but as the 16-bit value 00FB it is 251. You have to know how many bits the value has before you can tell whether it is negative.

    Limits

    • Numbers can be up to 1,000 digits long. Ordinary JavaScript numbers lose accuracy above 2⁵³ − 1 (9,007,199,254,740,991), but this tool calculates with BigInt fractions, so results stay exact to the last digit beyond that range.
    • If the fractional part neither ends nor starts repeating within 256 digits, the rest is shortened to …. The calculation uses fractions, so no error builds up in the other fields, but if you edit a field shortened with …, only the digits that are shown are read.
    • The bit board draws whole numbers only, up to 128 bits. For anything larger, check the whole value in the binary field.
    • It does not cover the bit layout of floating-point numbers (IEEE 754), fixed-point numbers, negative bases, or arithmetic such as adding and subtracting numbers in other bases.
    • All calculation happens in this browser, and the values you type are never sent to a server.

    Basis: the base and prefix rules come from the Python documentation and the ECMAScript specification, the two's complement ranges from the Java Language Specification, and the permission, color and network examples from POSIX, CSS and RFC documents, all checked on October 22, 2026. The table values were recomputed with this tool's calculation core and compared.

    Sources

    Frequently asked questions

    How do I convert decimal to binary?

    Divide by 2 and write the remainder beside each step, then divide the quotient by 2 again until the quotient is 1. Read the remainders from the last quotient upward. For 13 you get 6 remainder 1, 3 remainder 0, 1 remainder 1, so the binary number is 1101.

    How do I convert binary to decimal?

    Starting from the rightmost digit, multiply each digit by 1, 2, 4, 8, 16 and so on (powers of 2) and add the results. 1010 is 8 + 0 + 2 + 0 = 10, and 1111 1111 adds 128 down to 1 to give 255.

    What is hex FF in decimal?

    255. F stands for 15, so FF is 15 × 16 + 15 = 255. In binary it is 1111 1111 and in octal 377. It is the largest value one byte can hold, which is why FF is the brightest level in a color code.

    How are negative numbers written in binary?

    On paper you put a − in front, as in −101, but a computer stores two's complement: flip every bit of the positive number and add 1. In 8 bits, −5 is 0000 0101 flipped to 1111 1010, plus 1, giving 1111 1011 (hex FB). The bit board lets you pick a width and check it.

    Why does 0.1 never end in binary?

    0.1 is 1/10, and the denominator contains a 5. Binary only has the prime factor 2, so it cannot write a denominator with 5 exactly. The digits 0011 repeat forever, as in 0.0(0011), and a computer rounds them to 53 bits, which is why 0.1 + 0.2 is not exactly 0.3.

    Is there a quick way to convert binary to hex or octal?

    Yes. Group the binary digits in fours from the right for hex, or in threes for octal. 1 1110 1101 grouped in fours is 0001 1110 1101, which is 1ED in hex; grouped in threes it is 111 101 101, which is 755 in octal.

    What do 0x, 0b and 0o mean?

    They are prefixes that tell code which base a number is in: 0x for hexadecimal, 0b for binary and 0o for octal. Python and JavaScript both use them. This tool reads them when you paste them in, and copies them too if you turn the prefix option on.

    Which bases and how many digits are supported?

    Every base from 2 to 36. Digits 10 to 35 are written A to Z, and upper and lowercase mean the same. You can enter up to 1,000 digits, and large numbers are calculated with BigInt fractions, so they stay exact to the last digit.