Chapter 1 · Simulation

Number Base Converter

← Chapter 1
Width Format

Result:—

    Number Base Converter

    Goal: See how the same bit pattern is written in decimal, binary, octal and hexadecimal; follow the divide-and-take-the-remainder method from decimal to the other bases step by step; understand the two's complement representation of signed numbers.

    How to use it

    • Bit boxes: click a box (or Tab to it and press Space/Enter): the bit flips 0 ↔ 1. The number under each box is the value of that place (2k).
    • Fields: type a number in any base; the others update immediately. A value that does not fit gives an overflow warning.
    • 8 / 16 bits: n bits represent 0 to 2n−1 when unsigned.
    • Signed (two's complement): the leftmost bit has the value −2n−1 (−128 with 8 bits). With 8 bits the range is −128 … 127. For a negative number: convert |x| to binary, invert the bits, add 1.
    • Step by step: choose the target base and follow the divisions with Step or Play. The remainders are read from bottom to top.
    • Try it yourself: the page asks a question; type your answer in the field or enter it in the bit boxes, then press Check. Correct answers are counted.

    Shortcuts

    One hexadecimal digit corresponds to 4 bits, one octal digit to 3 bits: 0010 1101₂ = 2D₁₆; 101 101₂ = 55₈.

    Related slides: Chapter 1.3 · Computers (binary numbers, two's complement, overflow) and Chapter 1.1 · Basic Concepts (decimal-to-binary conversion).