Online developer tool
Binary / Bitwise Calculator
Enter a value in any base, inspect its bits, and run AND, OR, XOR, NOT, shift, and rotate operations at 8, 16, or 32-bit width.
How to use this calculator
Purpose
Use this tool to inspect a value's bit pattern, convert it between decimal, hex, binary, and octal, and separately run bitwise operations on two operands before writing firmware or register logic.
Main steps
- 1Choose the bit width (8, 16, or 32-bit). It applies to both the value converter and the calculator below, including two's complement for negative decimal input.
- 2In the value converter, pick the base of the value you already have and type it in to see all four formats and the bit grid. Click a bit to flip it, or hover to see its position.
- 3Copy any of the four formats, or generate a C #define and typed variable for that value right there.
- 4In the Calculator section, enter Operand A and Operand B directly (both decimal), or click "Use current value" to copy the value converter's value into Operand A.
- 5Pick an operation. AND, OR, and XOR use Operand B as a value; shift and rotate use it as the shift amount. NOT only uses Operand A. Copy the result once it looks right.
Value converter
Decimal
42
Hex
0x2A
Binary
00101010
Octal
052
Bits
C code
#define MASK_VALUE 0x2A
uint8_t mask_value = MASK_VALUE;Calculator
Operations
Result
Decimal
0
Hex
0x00
Binary
00000000
Octal
000
Client-side only · nothing is uploaded