Skip to content
Marvin's Toolbox.

Search tools

Type to filter all tools

Bitwise Calculator

Calculate AND, OR, XOR, NOT and bit shifts with a live binary view of every operand and the result. Enter numbers in decimal, hex, octal or binary and see each bit line up as you type.

Everything runs locally in your browser. Your data never leaves your device.

Operation

Operator
Bit width
Interpretation

AND keeps a bit set only where it is set in both A and B.

Operands

dec
dec

Prefixes pick the base automatically: 0x for hex, 0b for binary, 0o for octal, plain digits for decimal. Underscores and spaces between digits are ignored.

Binary view

A
12
& B
10
=
0
0
0
0
1
0
0
0
8

Bit 0 is on the right. Click any operand bit to flip it.

Result

12 & 10 = 8

Decimal
8
Hex
08
Binary1 set
0000 1000
Octal
010

Next steps

Keep going. These tools open with your result loaded in.

Convert text into every case at once: title case in the APA, AP, Chicago, MLA, Bluebook, AMA and NYT styles, sentence case, upper, lower, camelCase, snake_case, kebab-case and more.

Count words, characters, sentences, paragraphs, lines and more as you type, with estimated reading and speaking time.

Remove duplicate lines from a list or text, keeping the first occurrence. Optionally ignore case and whitespace, or drop blank lines too.

Replace text in two modes: plain find and replace all, or regular expressions with flag controls and capture group references like $1.

Compare two texts and see every added, removed and changed line highlighted, side by side or inline, with the changed words marked within each line. Ignore case, whitespace or blank lines, read a summary of how much changed, and export the result as a unified diff.

Paste a UUID to see what it carries: version, variant, and for time-based versions the exact timestamp, clock sequence and node. Also shows the raw bytes, the 128-bit integer and the URN form.

Decode Base64 to text or encode text to Base64. Paste into the top box, read the result below, and flip the direction with one click. Handles Unicode correctly, reads URL-safe Base64, and shows binary payloads as a hex dump you can download.

Convert numbers between binary, octal, decimal, hexadecimal and any base up to 36. Type into any field and the others update as you go. Handles huge integers without losing precision and accepts 0x, 0b and 0o prefixes.

Convert between scientific notation and full numbers as you type. Reads 1.23e5, 1.23 × 10^5 and plain numbers, shows the value written out, in normalized scientific notation and in engineering notation, and can round to any number of significant digits.

About the Bitwise Calculator Tool

This tool calculates bitwise AND, OR, XOR, NOT and bit shifts, and shows every bit while you work. Enter the operands in decimal, hex, binary or octal, pick a bit width from 8 to 64 bits and read the result in all four notations at once.

The binary view lines operand A, operand B and the result up column by column, so you can see exactly which bits combined into each result bit. Every operand bit is clickable, and flipping one updates the numbers right away.

What you can do

  • Calculate a bitwise AND, OR or XOR of two numbers.
  • Invert a number's bits with NOT at a chosen width.
  • Shift a number left or right by any count.
  • Mix bases freely, like ANDing 0xff with 0b1010.
  • Work in 8, 16, 32 or 64 bits, signed or unsigned.
  • Build a bitmask by clicking bits on and off.
  • Copy the result as decimal, hex, binary or octal.

How to use the Bitwise Calculator

  1. 1Pick the operator, the bit width and whether values read as signed or unsigned.
  2. 2Type the operands. Prefixes like 0x and 0b set the base automatically, or pin one with the base picker.
  3. 3Follow each bit column in the binary view and read the result in all four notations below.
  4. 4Chain calculations by clicking "Use result as operand A".

Fixed widths and truncation

Every calculation runs at the width you pick, exactly like a C integer type such as uint8_t or int64_t. A value that does not fit is truncated to its low bits and the tool tells you so, instead of quietly computing with a number you never entered. The same goes for shifts: set bits pushed past the top of the width are reported as lost.

Signed values and right shifts

In signed mode the leftmost bit is the sign bit, so the pattern 11111111 reads as -1 in 8 bits, and the binary view outlines that bit. The mode also decides how right shifts fill: unsigned values get a logical shift with zeros coming in from the left, signed values get an arithmetic shift that copies the sign bit, matching >> in most languages.

The math runs on big integers internally, so 64-bit patterns stay exact where a plain JavaScript number would round. For base conversion without an operator, the Number Base Converter handles numbers of any size.

Enter a resolution to get its simplified aspect ratio, or start from a ratio and one side to get the missing dimension. Knows the common ratios like 16:9, 4:3 and 21:9 and shows how close your size is to each.

Convert Unix file permissions between checkboxes, octal like 755 and symbolic notation like rwxr-xr-x, all kept in sync as you edit any of them. Covers setuid, setgid and the sticky bit, and shows the matching chmod command ready to copy.

Convert between px, rem, em, percent, pt and viewport units with a configurable root font size. Type into any field and the others update as you go, set the parent font size for em math, and read a conversion table for common sizes.

Work out how long a download or file transfer takes from the file size and your connection speed. Handles all the common size and speed units, breaks the duration down readably, compares typical connections and can also solve for speed or file size.

Work out an IPv4 or IPv6 network from an address with a prefix or netmask: network and broadcast addresses, usable host range, subnet mask, wildcard mask and address type. Adjust the prefix with a slider, read the binary breakdown, and split the network into smaller subnets.

Convert numbers between binary, octal, decimal, hexadecimal and any base up to 36. Type into any field and the others update as you go. Handles huge integers without losing precision and accepts 0x, 0b and 0o prefixes.