Ambimat GroupAmbimatAmbiSecureV2XeSIM & eUICCAmbiAutomationEngineering BlogAhmedabad · India · Est. 1982
Developer utility

Binary, hex and decimal calculator

Convert between binary, decimal, hex, and octal, then run bitwise AND, OR, XOR, NOT and shifts at a chosen 8/16/32/64-bit width — with signed/unsigned and two’s-complement views. BigInt-backed so 64-bit math stays exact.

Client-sideBigInt8/16/32/64-bit

How to use this tool

What it does

Performs bitwise and base conversions — AND/OR/XOR/shift across binary, hex and decimal.

When to use it

Use it when composing a flags byte or masking a field and you want to see the result in every base at once.

Worked example

XOR 0xF0 with 0x0F to get 0xFF, shown in binary and decimal too.

Base converter

Enter a value to see all bases.

Bitwise operation

Choose an operation and enter operands.
All parsing, base conversion, and bitwise math run locally in your browser using JavaScript BigInt. Nothing is uploaded — safe for register dumps and key material.

What this calculator does

This is a binary calculator built for embedded and security engineers who spend their days staring at registers, status words, and bit-packed flags. The left panel is a live base converter: type a value once and read it back in binary, decimal, hexadecimal, and octal at the same time. The right panel runs the bitwise operations you reach for when masking flags or assembling protocol fields — AND, OR, XOR, NOT, and the three shifts (left, logical right, arithmetic right). Both panels share the same notion of operand width and signedness, so the bit pattern you convert is the bit pattern you operate on.

Everything is computed with JavaScript BigInt and then masked to the selected width. That matters more than it sounds: the native JavaScript bitwise operators silently coerce their inputs to signed 32-bit integers, so a 64-bit mask, a 40-bit APDU field, or any value past 2147483647 comes out wrong. Using BigInt and an explicit width mask keeps 8, 16, 32, and 64-bit results exact and lets the signed view show genuine two’s-complement values.

When to use it

Reach for it whenever a value crosses a representation boundary. Decoding a smart-card status word and need to see 0x9000 as bits? Building an ISO 7816 class byte or an EMV tag bitmap one flag at a time? Checking that a left shift wraps the way the silicon will at 8 bits? Confirming that 0xFF is −1 when a field is signed? Each of those is a few keystrokes here. It also pairs naturally with byte-order work: convert a value, then take the hex into the endian converter to swap byte order, or into hex bytes to view it as a byte sequence.

Input and output

In the base converter, choose which base your typed value is in and the tool parses it accordingly; you can also paste with a 0x, 0b, or 0o prefix and it will infer the base. The output shows all four bases plus a nibble-grouped binary view (four bits per group) so long patterns stay readable. In the bitwise panel, operands A and B are read in the selected operand base; for NOT only operand A is used, and for shifts operand B is the shift amount. Results are masked to the active width and reported in binary, hex, decimal (both unsigned and signed two’s-complement), and octal. If a value does not fit the width, the high bits are dropped and the tool flags the truncation rather than hiding it.

Common mistakes

Related tools

Endian converter

Swap byte order on the hex you produce here.

Open endian →

Hex ↔ bytes

View a converted value as a sequence of bytes.

Open hex bytes →

More utilities

Parsers, decoders, and references for smart-card and FIDO engineers.

All resources →

Frequently asked questions

Why use BigInt instead of plain JavaScript bitwise operators?

JavaScript's &, |, ^, ~, and shift operators coerce their operands to signed 32-bit integers, so any value above 2^31-1 is silently truncated or flips sign. That makes them useless for 64-bit registers and unreliable even at 32 bits. This calculator performs every operation on BigInt values and masks the result to the selected width, so 8, 16, 32, and 64-bit results are all exact.

What is the difference between logical and arithmetic right shift?

A logical right shift (often written >>>) always fills the vacated high bits with zero, treating the value as unsigned. An arithmetic right shift (>>) replicates the sign bit so that a negative two's-complement number stays negative — it divides by powers of two with rounding toward negative infinity. This tool offers both and lets you pick the operand width that defines where the sign bit sits.

How is two's complement shown here?

When you set the interpretation to signed, the most significant bit of the chosen width is the sign bit. A value with that bit set is shown as a negative decimal equal to value minus 2^width, while the binary, hex, and octal views always show the raw unsigned bit pattern. That lets you see, for example, that the 8-bit pattern 11111111 is 255 unsigned and -1 signed at the same time.

Does the calculator send my values anywhere?

No. All parsing, base conversion, and bitwise math run locally in your browser using JavaScript BigInt. Nothing is uploaded, logged, or sent to a server, so it is safe to work with register dumps, key material, or device identifiers.

What happens when a value exceeds the selected width?

Inputs and results are masked to the chosen width (8, 16, 32, or 64 bits). If you enter a number larger than the width can hold, the high bits are discarded — exactly as they would be when written to a register of that size — and the tool flags that the value was truncated so the wrap-around is never silent.