Hex Converter — Hex / Decimal / Binary / Octal

Convert between hexadecimal, decimal, binary, and octal number systems. Supports signed/unsigned integers up to 64-bit, ASCII ↔ hex byte conversion, and visual bit display. All computation in-browser — your data never leaves your device.

Quick load:
⚙ Input
📊 Conversions
Hex
Decimal
Binary
Octal
Hex (0x)
Hex Bytes
Base64

Bit View

How Hexadecimal Works

Hexadecimal (base-16) is the lingua franca of low-level computing and smart card engineering. Each hex digit represents exactly 4 bits (a nibble), so one byte is always two hex digits. This makes it trivial to read binary data: 0xFF = 255 = 11111111 in binary.

Why hex, not decimal? Decimal digits don't align to byte boundaries. The value 200 in decimal is 0xC8 in hex — instantly readable as one byte. In smart card APDUs, EMV TLV data, and cryptographic keys, every value is expressed in hex because each pair of digits maps perfectly to one byte on the wire.

Number Base Reference

BaseNameDigits UsedPrefixExample (decimal 255)
2Binary0, 10b0b11111111
8Octal0–70o / 00377
10Decimal0–9(none)255
16Hexadecimal0–9, A–F0x0xFF

Smart Card Use Cases

ScenarioExampleNotes
EMV Tag 9F02 Authorized Amount000000011934 → $119.3412-digit BCD, n6 padded. Two digits per byte, last 2 = cents
APDU status word SW1 SW20x9000 (success), 0x6A82 (file not found)Always 2 bytes, big-endian
AID (Application Identifier)A0000000041010 (Mastercard)5-16 bytes, RID + PIX, big-endian
ATR historical bytes3B ... 8031E073FE21123456782900Variable length, protocol info
Cryptographic key (3DES)0123456789ABCDEFFEDCBA987654321016 bytes = 32 hex chars (double-length DES key)
Bit masks / flags0xFF00 = high byte set, low byte clearCommon in access bits, capability flags

EMV Amount Encoding (BCD)

EMV Tag 9F02 (Amount, Authorized) is stored as a 6-byte BCD (Binary-Coded Decimal) value. Each nibble represents one decimal digit. For example, $119.34 is encoded as 00 00 00 01 19 34 — 6 bytes, 12 nibbles, where the last 2 digits are the decimal portion (cents).

Try it: Click "EMV Amount 9F02" above, then look at "Hex Bytes" to see the 6-byte BCD encoding. The decimal value 11934 represents $119.34.

Signed vs Unsigned (Two's Complement)

When interpreting a hex value as a signed integer, the most significant bit (MSB) determines the sign. If the MSB is 1, the value is negative and computed via two's complement:

Examples (8-bit):
  0x7F = 0111 1111 = +127  (max positive)
  0x80 = 1000 0000 = -128  (min negative)
  0xFF = 1111 1111 = -1
  0x00 = 0000 0000 = 0

For n-bit two's complement:
  if MSB == 1:  value = -(2^n - unsigned_value)

Endianness

Multi-byte integers can be stored big-endian (most significant byte first) or little-endian (least significant byte first). Smart card protocols (EMV, ISO 7816, GlobalPlatform) almost universally use big-endian. x86 CPUs and many ARM implementations use little-endian.

ValueBig-endian (EMV/network)Little-endian (x86)
0x1234ABCD12 34 AB CDCD AB 34 12
0x0000FFFF00 00 FF FFFF FF 00 00

Use the "Swap Endian" button to reverse byte order — useful when converting between smart card data (big-endian) and x86 memory dumps (little-endian).

Related Tools