Skip to content

    Programmer Calculator

    Type a number in hex, decimal, octal or binary and see it in all four at once. Flip bits, pick a word size, and run bitwise operations with exact 64-bit math.

    Input base
    Word size
    Mode
    HEX0000 00FF
    DEC255
    OCT377
    BIN0000 0000 0000 0000 0000 0000 1111 1111

    ASCII: only for values 0–127

    Bits of A (tap a bit to flip it)
    31
    27
    23
    19
    15
    11
    7
    3
    255 AND 4 = 4
    HEX0000 0004
    DEC4
    OCT4
    BIN0000 0000 0000 0000 0000 0000 0000 0100

    The input base controls how you type numbers A and B. Switching it rewrites both numbers in the new base without changing their value. The hex, octal and binary rows always show the raw bit pattern of the word, while the decimal row shows the value as signed or unsigned depending on the mode.

    The word size sets how many bits a value has. Anything that doesn't fit is wrapped the way a real processor would, and the calculator warns you when that happens. Division is integer division that rounds toward zero, and the remainder takes the sign of A, matching C, Java and JavaScript.

    Shifts and rotates use B as the number of places. Shifting left by one doubles the value; rotating moves the bits that fall off one end back in at the other, so no information is lost.

    Why is -1 shown as FF or FFFFFFFF?

    Signed numbers are stored in two's complement. In 8 bits, -1 is every bit set, which reads as FF in hex and 11111111 in binary. The decimal row shows -1 in signed mode and 255 in unsigned mode because it's the same bit pattern read two ways.

    What does overflow mean here?

    Each word size can only hold a fixed range: 8-bit signed holds -128 to 127, 8-bit unsigned holds 0 to 255. When the true answer falls outside that range, the extra bits are dropped and the value wraps around, exactly like it would in C, Java, or a CPU register. The calculator tells you whenever that happens.

    What's the difference between a logical and an arithmetic right shift?

    A logical shift fills the new high bits with 0, so it treats the value as unsigned. An arithmetic shift copies the sign bit into the new high bits, so a negative number stays negative (-16 >> 2 = -4). For positive numbers they give the same answer.

    Is 64-bit math exact?

    Yes. Everything is computed with arbitrary-precision integers and then wrapped to the chosen word size, so 64-bit values like 18446744073709551615 are exact rather than rounded the way ordinary JavaScript numbers would be.

    Sponsored ToolsAd

    More tools on Ytools →
    Calcu.click — 25+ Free Smart Calculators preview

    Calcu.click — 25+ Free Smart Calculators

    Brand new calculation platform with 0ms reactive math, 100% client-side privacy, and dedicated subdomains. Fast calculators for EMI, SIP, Mortgage, Income Tax, BMI, Age, Percentage, and more.

    25+ CalculatorsFinanceHealth0ms Real-TimeFree
    Keyboard Arena preview

    Keyboard Arena

    Master touch typing with real-time WPM speed tests, mechanical switch audio, A-Z finger biomechanics drills, 40+ structured lessons, and competitive arcade games.

    Typing TestWPMTouch Typing
    Flutter Log Explorer preview

    Flutter Log Explorer

    Real-time structured log viewer and search explorer for Flutter & Dart. Zero-config capture from Debug Adapter (DAP) & Dart VM Service with smart classification and filters.

    FlutterDartVS Code ExtensionOpen VSX