Programmer Calculator
Convert between decimal, hexadecimal, octal and binary and apply bitwise and shift operations.
About this calculator
Convert integers between binary, octal, decimal, and hexadecimal, and apply bitwise operations. Type in any base and the others update live.
Number bases
- Binary (base 2) — digits 0–1, used by computers.
- Octal (base 8) — digits 0–7.
- Decimal (base 10) — everyday numbers.
- Hexadecimal (base 16) — digits 0–9 and A–F, common in programming.
Bitwise operations
AND, OR, XOR, and NOT compare bits position by position; shifts (≪, ≫) move bits left or right, which multiplies or divides by powers of two.
Signed numbers
Negative values use two's complement, where the highest bit indicates the sign. Toggle the signed mode to see how the same bits represent a negative number.
How to use Programmer Calculator
- 1Enter the value (two, ten, sixteen or eight) below the current evolution.
- 2Switches to the target digit that you want to see.
- 3View the value after conversion and, if necessary, the by-bit calculation (AND, OR, XOR, migration).
Programr Calculator
Bitwork: a AND b to keep both 1 bits; a XOR b to keep exactly 1 bitsThe programmer calculator works between binary, octadecimal, decimal and hexadecimal and exposes the bit logic used in the bottom code.
Bits and/or bits or transpositions are the basis for tagging, masking and embedded controls.
Bitwork directly handles binary bits, which are extremely fast and are used extensively in system programming, permission control, graphic processing. Some of the most practical techniques: ** to judge the eccentricity of n & 1** (quicker than n %2); ** to multiply the ecliptic shift** (n < 3 = n × 8, n > > 2 = n ÷ 4 rounded); ** to exchange two numbers without a temporary variable** (a ^ = b; b ^ = a; a ^ = b); ** to eliminate the lowest 1** (n & (n-1) to match the number of 1 in the repertoipherical binary, which is the high frequency of interviews).
The permission system prefers a bit sign: read = 1, write = 2, execute = 4, so the "read & write" permission is 1 |2 = 3; determine if write permission is available for perm & 2; revoke write permission for perm & ~2. Unix file permission 755 is a combination of three groups (owner rwx=7, group rx=5, other rx=5). ** The advantage of a bit of storage sign is that any combination requires only one integer** and storage and transmission is saved.
| Operations | Symbol | Example: | Result | Usual uses |
|---|---|---|---|---|
| By Bit and | & | 12 & 10 | 8 | Extract a given location/ mask |
| By Bit or | | | 12 | 10 | 14 | Place (open sign) |
| Bitwise or differently | ^ | 12 ^ 10 | 6 | Flip / Swap Variable |
| Against | ~ | ~12 | -13 | Bit Invert (compensation) |
| Shift left | << | 3 << 2 | 12 | Multiply 2n |
| Shift right | >> | 12 >> 2 | 3 | divided by 2n |
| I'm judging the doll. | & 1 | 7 & 1 | 1 | Result is 1 or odd |
Bitwork True Table and Usual Techniques
Frequently asked questions
What's the point?
It hides the value and keeps only the bit in the mask, which is also 1.
Why move instead of multiplying?
Move n bit left equals 2^n, often faster in the hardware layer.
What's a patch?
A symbol integer is the standard way to indicate a negative number: a bit inverse.
What do you want to notice when you move left?
The left moves the height and may spill a variable (number of symbols). Shift right in two ways: the right of arithmetic (reserved sign bit, negative number added 1, Java/C > ) and the right of logic (filled 0, Java > >, unsigned number of C). The right shift of negative numbers must be especially careful. The other digit cannot equal or exceed the width of the data, otherwise the behaviour is not defined.
Why ~12 equals 13 instead of 3?
Because it's a patch. 12 is 00001100, reverse 11110011, which corresponds to the number of symbols -13 (certification: 11110011 against 00001100, plus 1 plus 000011011 = 13, so the original value is -13). The result depends on whether there are symbols or not, and the same bit mode explains different results.
