back to tool directory
Programmer's Calculator
// bin · dec · hex — convert and calculate. integers only: the floating point was moved to another server
automationhub — ~/tools/calculator --bitwise --no-float
Base Calculator
Type a number or an expression. Bare numbers are read in the selected base — 0b and 0x prefixes work in any mode. Arithmetic is integer throughout: / is integer division, ^ is bitwise XOR (not power), and ~ flips every bit. Pick a bit width to wrap results like two's complement does in C.
$ base (for bare numbers)
$ bit width (two's complement wrap)
// floats were moved to another server
output — all bases, live
idle
- dec
- 0
- hex
- 0
- bin
- 0
bit view — auto · amber bit is the sign
// where 0x7fffffff + 1 becomes 0x80000000 and the compiler just shrugs
history — click to reuse
- // nothing yet. the calculator remembers everything and judges nothing
// operator precedence — top row binds tightest; parentheses always win, like always
| operators | name | note |
|---|---|---|
| ~ - | unary | bitwise NOT / negate — ~0x0f turns on every other bit |
| * / % | arithmetic | / is integer division — truncates like C, no decimals, no mercy |
| + - | arithmetic | the only place + means "add" |
| << >> | shift | move bits, lose the ends — shifting by ≥ width is refused (undefined behavior) |
| & | bitwise AND | keep what both operands agree on |
| ^ | bitwise XOR | not exponentiation — this is a programming calculator |
| | | bitwise OR | keep what either operand mentions |
// constants worth knowing — click a row to insert it
| value | decimal | why you know it |
|---|---|---|
| 0xFF | 255 | one byte of everything |
| 0xFFFF | 65535 | 16 bits, all on |
| 0xFFFFFFFF | 4294967295 | 32 bits all on — that's -1 in two's complement |
| 0x7FFFFFFF | 2147483647 | INT_MAX — the largest int is allowed to be |
| 0x80000000 | 2147483648 | INT_MIN, unsigned — the loneliest number |
| 0xDEADBEEF | 3735928559 | the classic crash signature |