Programmer Calculator – 64-Bit Base Converter & Bitwise Operations
Programmer Calculator – Base Converter & Bitwise Logic
This tool performs two core tasks used in software development and computer science: base conversion between Decimal, Hexadecimal, Binary, and Octal, and bitwise logic operations (AND, OR, XOR, NOT, left shift, right shift) in 64-bit precision. Values update live across all number bases as you type.
Useful for working with memory addresses, bitmask flags, network subnets, color codes, assembly instructions, and any low-level programming task where you need to see a number in multiple bases simultaneously.
Number Base Reference
| Base | Name | Digits Used | Prefix | Example (255) | Common Use |
|---|---|---|---|---|---|
| 10 | Decimal | 0–9 | — | 255 | Human arithmetic, prices |
| 16 | Hexadecimal | 0–9, A–F | 0x | 0xFF | Memory addresses, colors (#RRGGBB) |
| 2 | Binary | 0, 1 | 0b | 0b11111111 | Bitmask flags, CPU instructions |
| 8 | Octal | 0–7 | 0o | 0o377 | Unix file permissions (chmod 755) |
Bitwise Operations Reference
| Operation | Symbol | Rule | Example (binary) | Result (dec) | Real-World Use |
|---|---|---|---|---|---|
| AND | & | 1 only if both bits are 1 | 1010 & 1100 | 8 | Subnet mask, bit clearing |
| OR | | | 1 if either bit is 1 | 1010 | 1100 | 14 | Setting permission flags |
| XOR | ^ | 1 only if bits differ | 1010 ^ 1100 | 6 | Encryption, checksums, swap |
| NOT | ~ | Flips every bit | ~0000 1010 | −11 | Two's complement, bit inversion |
| Left Shift | << | Shift bits left, fill 0s right | 5 << 2 | 20 | Fast multiply by power of 2 |
| Right Shift | >> | Shift bits right, fill 0s left | 20 >> 2 | 5 | Fast divide by power of 2 |
Practical Use Cases
Web Color Codes
CSS colors like #1A73E8 are hex. Convert to decimal to get R=26, G=115, B=232 for use in CSS rgb() or rgba() functions.
Unix File Permissions
chmod 755 is octal 111 101 101. Convert to binary to see exact read/write/execute bits for owner, group, and others.
Network Subnets
A subnet mask of 255.255.255.0 is 0xFFFFFF00 in hex and 11111111.11111111.11111111.00000000 in binary — AND with IP address to get the network address.
Frequently Asked Questions
How do I convert a decimal number to hexadecimal?
Type the decimal number in the DEC field. The HEX, BIN, and OCT equivalents update instantly. For example, 255 (decimal) = FF (hex) = 11111111 (binary) = 377 (octal).
What does the AND bitwise operation do?
AND compares each bit position in two numbers. The result bit is 1 only if both input bits are 1. Example: 0b1010 AND 0b1100 = 0b1000 (decimal 8). Used in networking for subnet mask operations.
What is OR used for in programming?
OR sets a result bit to 1 if either input bit is 1. Example: 0b1010 OR 0b1100 = 0b1110 (decimal 14). Commonly used to set specific bits in a flags variable without affecting others.
What does XOR do and where is it used?
XOR (Exclusive OR) outputs 1 when the bits differ. 0b1010 XOR 0b1100 = 0b0110 (decimal 6). XOR is used in encryption, checksums, and the classic in-place variable swap algorithm.
What is a left shift (<<) operation?
Left shift moves all bits to the left by N positions, filling with zeros on the right. This is equivalent to multiplying by 2^N. For example, 5 << 2 = 20 (same as 5 × 4).
Why does this calculator work in 64-bit mode?
64-bit mode matches modern CPU architectures (AMD64, ARM64) and covers the full range of integers used in most programming languages — from 0 to 2^64−1 for unsigned, or −2^63 to 2^63−1 for signed integers.