Programmer Calculator
Hex, Octal, Binary conversions with bitwise AND, OR, XOR, NOT & shift operations.
About the Programmer Calculator
The Programmer Calculator is built for developers, computer-science students, and embedded-systems engineers who routinely jump between decimal, hexadecimal, octal, and binary representations of the same number. It also handles the bitwise operations you reach for when working with hardware registers, network masks, or flag fields: AND, OR, XOR, NOT, and logical / arithmetic shifts in either direction. Everything happens client-side in JavaScript — your inputs never leave your browser, which matters if you’re testing real values from a production system. Inputs accept any of the four common bases (with the standard 0x, 0o, and 0b prefixes or without), and the result is shown simultaneously in all four bases so you can verify by eye that the conversion is consistent.
Features in This Tool
- Base conversion between decimal (base 10), hexadecimal (base 16), octal (base 8), and binary (base 2). Useful when reading a microcontroller datasheet that lists register addresses in hex but expects the user to know which bits map to which feature.
- Bitwise operators: AND (
&), OR (|), XOR (^), NOT (~), left shift (<<), and right shift (>>). Operates on configurable word sizes (8, 16, 32, 64 bit), which matters when checking sign-extension on negative numbers. - Two’s-complement display for signed integers, so you can see how −1 actually looks in memory (all bits set) and confirm that your bitmask is doing what you think.
- IEEE 754 float decoding — paste a 32-bit or 64-bit hex value and the calculator will decode the sign, exponent, and mantissa, and show the float value it represents. Useful when debugging a binary protocol that transports floats over the wire.
- ASCII / UTF-8 lookup — convert a character to its code point and back, with the byte sequence for non-ASCII code points displayed in hex.
When Programmers Use This Calculator
The most common use case is checking a hardware register. If a microcontroller datasheet says “set bit 3 of register CTRL to enable the timer,” you can paste the current value of CTRL (in hex, the way a debugger prints it) and OR it with 0x08 to set bit 3, then convert back to hex for the write. The calculator’s bitwise mode shows the bit pattern visually so you can confirm that only bit 3 has flipped.
A second use case is verifying a subnet mask. /24 is 255.255.255.0 which is 0xFFFFFF00 which is 11111111.11111111.11111111.00000000 in binary — easy to confirm by pasting any of those forms and reading the others off the result panel.
A third use case is decoding a stored float. If a binary file contains 0x40490FDB as a 32-bit IEEE 754 float, the calculator will tell you it represents 3.1415927 — almost certainly somebody storing π in single precision.
Frequently Asked Questions
What word size does the calculator default to?
32-bit two’s-complement, which matches most embedded systems and the C int on 32-bit platforms. You can switch to 8, 16, or 64 bit from the word-size dropdown. The display masks the result to the chosen word size, so overflow behaves the way it does on real hardware.
How does the NOT operator behave on a negative number?
NOT inverts every bit in the chosen word size. For an 8-bit value, NOT(0x00) is 0xFF, which is −1 in two’s-complement. For a 32-bit value, NOT(0x00000000) is 0xFFFFFFFF, also −1. The visual bit panel shows the inversion happening so the behaviour is unambiguous.
Is there a difference between logical and arithmetic right shift?
Yes — and the calculator distinguishes them. Logical right shift (>>> in JavaScript) fills the high bits with zero; arithmetic right shift (>> in C for signed types) replicates the sign bit. For negative numbers this matters: −8 arithmetically shifted right by 1 is −4; logically shifted right by 1 it becomes a very large positive number on a 32-bit word.
Are my inputs stored or sent to a server?
No. The programmer calculator runs entirely in your browser. Nothing is transmitted, logged, or persisted. You can use it for sensitive values (encryption keys, internal addresses) without leaking them.
Related calculator categories: Electrical engineering · Mechanical engineering · Physics · Unit converter · Financial calculators