# Programmer calculator

> Base conversions, bitwise ops, and a clickable bit grid.

Free programmer calculator. Convert between binary, octal, decimal, and hexadecimal with live sync, evaluate expressions with C-like precedence, run bitwise AND, OR, XOR, NOT and shifts, toggle individual bits, and read signed and unsigned 8/16/32/64-bit interpretations plus the ASCII character.

- Page: https://benchline.fabwaseem.com/t/programmer-calculator
- Runs: in the browser. Input stays on the device.
- Price: free, no account
- Input: An integer expression or a base-prefixed literal, a bit width, and optional bitwise operands.
- Output: Binary, octal, decimal, and hex forms, signed/unsigned readings per width, ASCII, and the bit grid.
- Keywords: programmer calculator, hex to decimal, binary calculator, bitwise calculator, base converter
- Updated: 2026-10-18
- Built by: Waseem Anjum (https://fabwaseem.com)

## How to use it

1. **Enter a value.** Type an expression or edit any base field; the other three bases update instantly.
2. **Pick a width.** Choose 8, 16, 32, or 64 bits to see the signed and unsigned interpretations.
3. **Toggle bits.** Click bits in the grid to flip them, or run a bitwise operation on two operands.

## Use it from an AI agent

MCP tool name: `calculate_programmer`
MCP endpoint: https://benchline.fabwaseem.com/mcp (Streamable HTTP, no key)
HTTP: POST https://benchline.fabwaseem.com/api/v1/tools/programmer-calculator with the input as the JSON body
This call does not fetch anything. It runs on the arguments you send.

Evaluate integer expressions with C-like precedence (hex/octal/binary literals, bitwise ops, shifts) and report base conversions plus signed/unsigned interpretations.

### Input schema

```json
{
  "type": "object",
  "properties": {
    "expression": {
      "description": "Integer expression, e.g. '0xFF & 0x0F | (1 << 4)'",
      "type": "string"
    },
    "op": {
      "description": "Bitwise operation (alternative to expression)",
      "type": "string",
      "enum": [
        "and",
        "or",
        "xor",
        "not",
        "shl",
        "shr"
      ]
    },
    "a": {
      "description": "First operand, e.g. '0xFF' or '255'",
      "type": "string"
    },
    "b": {
      "description": "Second operand (not needed for 'not')",
      "type": "string"
    },
    "bits": {
      "default": "64",
      "description": "Bit width for masking and signed interpretation",
      "type": "string",
      "enum": [
        "8",
        "16",
        "32",
        "64"
      ]
    }
  },
  "required": [
    "bits"
  ],
  "additionalProperties": false
}
```

### Example tools/call

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "calculate_programmer",
    "arguments": {
      "bits": "64"
    }
  }
}
```

Setup for Claude, Cursor, and VS Code: https://benchline.fabwaseem.com/mcp/guide

## Questions

### Which number formats can I type?

0x for hexadecimal, 0b for binary, 0o for octal, and plain decimal. Underscores are allowed as separators, like 0xFF_FF.

### How do expressions work?

Type something like 0xFF & 0x0F | (1 << 4). Operators follow C precedence: shifts, then &, then ^, then |. ~, unary minus, parentheses, and % all work. Division truncates toward zero.

### What does the bit width change?

NOT, shifts, and the signed/unsigned readings are masked to the selected width, so 8-bit ~0 is 255 and reads as -1 signed.

### Is the math exact?

Yes. Everything is BigInt, so all 64 bits are exact. There is no floating point anywhere.

## Related tools

- [Base64 codec](https://benchline.fabwaseem.com/t/base64-codec): Encode and decode Base64 for text or a file, including the URL-safe alphabet.
- [Unit converter](https://benchline.fabwaseem.com/t/unit-converter): Length, mass, temperature, and data sizes, with decimal and binary units kept apart.
- [Chmod calculator](https://benchline.fabwaseem.com/t/chmod-calculator): Turn a permission grid into octal and symbolic chmod, and back.
- [Hash generator](https://benchline.fabwaseem.com/t/hash-generator): MD5, SHA-1, SHA-256, and SHA-512 checksums for text or a file, with HMAC.
