Tools/Converters

Hex Converter: Hexadecimal to Text, Decimal, Binary, and Base64

Convert between hexadecimal, text (UTF-8), decimal, binary, and Base64. Essential tool for blockchain developers working with transaction data, opcodes, and addresses.

Spark TeamInvalid Date
0 bytes

Type in any field to convert between hex, text, decimal, binary, and Base64. Hex input accepts 0x prefix, spaces, and colons. All processing runs in your browser.

What Is Hexadecimal?

Hexadecimal (hex) is a base-16 number system that uses sixteen distinct symbols: the digits 0 through 9 and the letters A through F. Each hex digit represents exactly four bits of binary data, which makes hex a compact and convenient way to express binary values. Two hex characters encode one byte (8 bits), so a 32-byte value like a SHA-256 hash becomes a 64-character hex string rather than a 256-character binary string.

The hex system is fundamental to computing because it maps cleanly onto the binary representation that processors actually use. A single hex digit corresponds to a 4-bit nibble, and a pair of hex digits corresponds to a full byte. This one-to-one mapping between hex and binary makes it straightforward to read memory addresses, color codes, machine instructions, and cryptographic outputs without dealing with long strings of ones and zeros.

In most programming contexts, hexadecimal values are prefixed with 0x to distinguish them from decimal numbers. For example, 0xFF represents the decimal value 255, and 0x00 represents zero. The letters A through F can be uppercase or lowercase: 0xff and 0xFF are equivalent.

Hex in Blockchain

Hexadecimal notation appears throughout blockchain technology. Nearly every low-level data structure in Bitcoin and other blockchains is represented, transmitted, and stored in hex format. Understanding hex is essential for anyone working with raw transaction data, building wallets, or analyzing on-chain activity.

Transaction IDs

Every Bitcoin transaction is identified by its txid: a 64-character hex string that represents the double SHA-256 hash of the serialized transaction. When you look up a transaction on a block explorer, the identifier you see is a hex-encoded 32-byte hash. For example, the coinbase transaction in the Bitcoin genesis block has txid 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b.

Block Hashes

Block hashes follow the same pattern: they are 64-character hex strings produced by double SHA-256 hashing the 80-byte block header. The difficulty target in proof-of-work mining requires the block hash to be below a certain threshold, which in hex means the hash must start with a specific number of leading zeros.

Addresses and Public Keys

Bitcoin public keys are 33 bytes (compressed) or 65 bytes (uncompressed), typically shown in hex before being encoded into Base58Check or Bech32 address formats. Ethereum addresses are 40-character hex strings (20 bytes) prefixed with 0x. When debugging address derivation or verifying key pairs, you work directly with hex representations.

Opcodes and Script

Bitcoin Script is a stack-based language where each instruction is a single byte. These opcodes are universally referenced by their hex values. A standard Pay-to-Public-Key-Hash (P2PKH) script looks like 76 a9 14 [20-byte hash] 88 ac in hex, where 0x76 is OP_DUP, 0xa9 is OP_HASH160, 0x88 is OP_EQUALVERIFY, and 0xac is OP_CHECKSIG.

Smart Contract Data

On Ethereum and EVM-compatible chains, smart contract calls are encoded as hex data in the transaction's input field. The first 4 bytes (8 hex characters) are the function selector derived from the Keccak-256 hash of the function signature, followed by ABI-encoded parameters. For example, an ERC-20 transfer() call begins with the selector 0xa9059cbb.

Conversion Reference

The following table shows how different values appear across common number systems and encodings. Each row represents the same underlying data in different formats.

HexDecimalBinaryASCII
00000000000NUL
0A1000001010LF (newline)
203200100000Space
3048001100000
416501000001A
619701100001a
7F12701111111DEL
FF25511111111N/A (extended)

Common Hex Values in Crypto

Certain hex values appear frequently in blockchain development. The following table lists Bitcoin Script opcodes, Ethereum constants, and other common hex values that developers encounter regularly.

Hex ValueNameContext
0x76OP_DUPBitcoin Script: duplicate top stack item
0xa9OP_HASH160Bitcoin Script: SHA-256 then RIPEMD-160
0xacOP_CHECKSIGBitcoin Script: verify signature
0x6aOP_RETURNBitcoin Script: mark output as unspendable data
0x88OP_EQUALVERIFYBitcoin Script: check equality and verify
0x00OP_0 / OP_FALSEBitcoin Script: push empty byte array
0x51OP_1 / OP_TRUEBitcoin Script: push the number 1
0xaeOP_CHECKMULTISIGBitcoin Script: verify multisig
0xa9059cbbtransfer(address,uint256)ERC-20 function selector
0x095ea7b3approve(address,uint256)ERC-20 function selector
0x70a08231balanceOf(address)ERC-20 function selector
0xdeadbeefDebug markerCommon placeholder in development and testing

Hex vs Other Number Systems

Hexadecimal is one of several number systems commonly used in computing. Each system has different trade-offs between compactness, readability, and how directly it maps to underlying binary data. The following table compares the four most common number systems.

PropertyBinary (Base-2)Octal (Base-8)Decimal (Base-10)Hex (Base-16)
Digits used0, 10-70-90-9, A-F
Bits per digit13~3.324
One byte requires8 digits3 digits1-3 digits2 digits
Common prefix0b0oNone0x
255 expressed as11111111377255FF
Primary useLogic gates, bit flagsUnix permissionsHuman-readable mathMemory, crypto, colors
Blockchain usageRare (too verbose)RareAmounts, balancesHashes, addresses, data

Binary is the native language of computers but impractical for humans to read at scale. Octal was historically used in early computing systems and survives mainly in Unix file permissions. Decimal is intuitive for everyday arithmetic but does not align cleanly with byte boundaries. Hexadecimal offers the best balance: it maps perfectly to binary (each hex digit equals exactly 4 bits), produces compact representations, and is universally used in blockchain, networking, and systems programming.

Frequently Asked Questions

What is hexadecimal used for in blockchain?

Hexadecimal is the standard representation for nearly all raw blockchain data. Transaction IDs, block hashes, public keys, addresses, Script opcodes, smart contract calldata, and cryptographic signatures are all expressed in hex. This is because hex maps directly to binary data (2 hex chars = 1 byte), making it compact yet readable for developers working with low-level protocol data.

How do I convert hex to text?

Each pair of hex characters represents one byte. To convert hex to text, split the hex string into pairs, convert each pair to its decimal byte value, and then interpret those bytes as UTF-8 (or ASCII) characters. For example, 48 65 6c 6c 6f decodes to "Hello" because 0x48 = 72 (H), 0x65 = 101 (e), 0x6c = 108 (l), 0x6c = 108 (l), and 0x6f = 111 (o). Not all hex sequences produce valid text: bytes above 0x7F may require multi-byte UTF-8 sequences.

What is the difference between hex and binary?

Binary (base-2) uses only the digits 0 and 1, while hexadecimal (base-16) uses 0-9 and A-F. They represent the same data in different ways. Each hex digit maps to exactly 4 binary digits: A in hex equals 1010 in binary, F equals 1111. Hex is preferred for human readability because it is four times more compact than binary. The byte 0xFF in hex is 11111111 in binary.

How do I convert hex to decimal?

Multiply each hex digit by its positional power of 16 and sum the results. For example, 0x1A3 = (1 x 256) + (10 x 16) + (3 x 1) = 256 + 160 + 3 = 419 in decimal. For multi-byte values common in blockchain (like 32-byte hashes), the resulting decimal number can be extremely large, requiring arbitrary-precision arithmetic (BigInt) to represent accurately.

Why do blockchain explorers show data in hex?

Block explorers display raw data in hex because it is the most direct representation of the underlying bytes. Hex preserves the exact binary structure without interpretation: you can see individual opcodes, read version bytes, identify address prefixes, and verify hash outputs directly. Displaying data in decimal would lose the byte-level structure, while binary would be too verbose to be practical.

What does the 0x prefix mean?

The 0x prefix is a convention indicating that the following characters should be interpreted as a hexadecimal number rather than decimal. Without it, the string "10" is ambiguous: it could mean ten (decimal) or sixteen (hex). The prefix originated in C programming and is now standard across most programming languages, blockchain protocols, and developer tools. Ethereum addresses always include the 0x prefix; Bitcoin typically omits it.

Can hex values contain spaces?

In raw hex encoding, spaces are not part of the data. However, spaces are often added between byte pairs for readability. For example, 48 65 6c 6c 6f and 48656c6c6f represent the same data. Most hex conversion tools (including this one) strip spaces and other whitespace before processing. Some tools also accept colons as separators, as in 48:65:6c:6c:6f.

How large can a hex number be?

There is no theoretical limit to the size of a hex number. In practice, blockchain applications commonly use 32-byte (256-bit) values for hashes and 20-byte (160-bit) values for addresses. A 32-byte hex string is 64 characters long and can represent numbers up to 2^256 - 1, which is approximately 1.16 x 10^77 in decimal. This tool uses BigInt arithmetic to handle arbitrarily large hex values without loss of precision.

This tool runs entirely in your browser. No data is sent to any server. Spark does not store, transmit, or have access to any values you enter. Always verify critical outputs independently.

Build with Spark

Integrate bitcoin, Lightning, and stablecoins into your app with a few lines of code.

Read the docs →