Binary private key โ HEX, WIF and addresses
Enter the private key as 256 bits of 0/1 โ spaces, newlines, colons and underscores are ignored โ and watch the bits regroup into bytes, a HEX key, both WIFs, both public keys and all ten addresses. This is the view where you can see exactly which bit does what.
Enter a value above and press Convert. Not sure what to type? Press โUse exampleโ to load the sample from the placeholder.
What this page computes
This page accepts the private key as raw bits โ up to 256 characters of 0
and 1 โ and shows what every one of those bits does. Spaces, tabs, newlines, colons, dashes
and underscores are ignored, so you can paste a key in whatever layout your source used. The bits are then
regrouped into bytes, converted to hex, and the full derivation runs from there.
This is the only page in the set where you can see which bit produces which address, because binary is the one representation that does not hide the machine's own unit of work.
1. Bit, nibble, byte, word
The units matter because every conversion on this page is a regrouping of the same bits:
| Unit | Size | Written as | In a 256-bit key |
|---|---|---|---|
| bit | 1 | 0 or 1 | 256 of them |
| nibble (half-byte) | 4 bits | one hex digit 0โf | 64 of them |
| byte (octet) | 8 bits | two hex digits, e.g. 08 | 32 of them |
| 32-bit word | 32 bits | 8 hex digits | 8 of them |
| the whole key | 256 bits | 64 hex digits / 32 bytes | 1 |
The relationship is exact and has no remainder: 8 bits are always 2 hex digits, 4 bits are always 1, and 256 divides evenly by both. That is the entire reason hexadecimal exists in this domain โ it is a lossless human-readable view of binary, not a separate number system with its own rules.
2. Binary โ hex, digit pair by digit pair
The conversion is done by nibble grouping, and it never requires arithmetic on the whole number:
for each group of 4 bits (left to right):
value = 8*b3 + 4*b2 + 2*b1 + 1*b0 # 0..15
emit "0123456789abcdef"[value]
Applied to the demo key's first four bytes:
bits 0000 1000 0010 0100 1100 0011 0001 0100
hex 0 8 2 4 c 3 1 4
โ
byte 0 = 0x08 ยท byte 1 = 0x24 ยท byte 2 = 0xc3 ยท byte 3 = 0x14
| 4-bit group | Value | Hex digit | 4-bit group | Value | Hex digit |
|---|---|---|---|---|---|
0000 | 0 | 0 | 1000 | 8 | 8 |
0001 | 1 | 1 | 1001 | 9 | 9 |
0010 | 2 | 2 | 1010 | 10 | a |
0011 | 3 | 3 | 1011 | 11 | b |
0100 | 4 | 4 | 1100 | 12 | c |
0101 | 5 | 5 | 1101 | 13 | d |
0110 | 6 | 6 | 1110 | 14 | e |
0111 | 7 | 7 | 1111 | 15 | f |
Note that this page pads your input on the left to the next byte boundary before converting, and
then the key validator pads again to a full 32 bytes. Typing 1 is therefore the key
1 โ not 0x10, and not an error. Left is the most-significant end, and that is the
rule for every fixed-width integer in Bitcoin key material.
3. Big-endian and little-endian
"Endianness" is only a question when a multi-byte value is written to a byte sequence: do the significant bytes come first or last? Bitcoin is famously inconsistent about it, and the inconsistency is a top source of interoperability bugs.
| Field | Byte order | Why it matters to you |
|---|---|---|
| Private key (32 bytes), public key X/Y, hash160, x-only Taproot key | Big-endian | Hex as written is the number as written. No reversal, ever. |
| WIF payload, BIP32 extended key material, BIP39 seed | Big-endian | Copy the bytes in order; the address/WIF arithmetic depends on it. |
| Transaction version | Little-endian (int32) | Byte 1 of a raw tx is the low byte of the version |
| Transaction input/output counts and script lengths | VarInt (CompactSize), little-endian | 01 means "one input" only for small counts; โฅ 0xfd uses a prefix |
| Outpoint transaction id as serialized | Little-endian (reversed from display) | What an explorer shows as 3a1bโฆ is stored โฆ1b3a |
| Output amounts (satoshis, int64) | Little-endian | 1 BTC = 100000000 satoshis, written low byte first |
| Block header version, timestamp, bits, nonce | Little-endian (uint32) | Mining and header parsing both depend on this |
| Proof-of-work block hashes as displayed | Big-endian (reversed from the internal hash) | The famous leading zeros of a block hash are the end of the internal byte order |
| Bech32 data words | 5-bit groups, most-significant bit first | The 8โ5 bit regrouping is why bc1 addresses are longer than the program they carry |
Key material (private keys, public keys, hashes used in addresses, seeds) is big-endian โ the way you see it is the way it is. Consensus serialization (amounts, indexes, versions, lengths) is little-endian. If you find yourself reversing bytes while deriving an address, you have almost certainly made a mistake; if you find yourself not reversing while parsing a raw transaction, you probably have too.
4. Why leading zeros carry meaning
In ordinary arithmetic 0001 and 1 are the same number, and many programming
languages will happily agree. In a serialized key they are not the same bytes, and the byte count
is fixed by the protocol at 32. A key's leading zeros are therefore data: they say "this key is small", and
dropping them shifts every following bit to the left.
| Key (decimal) | Hex, 64 digits | Leading zero bits | Result of dropping the zeros |
|---|---|---|---|
1 | 0000000000000000000000000000000000000000000000000000000000000001 | 255 | 1 โ accidentally still correct, but only because the padding is restored |
256 | 0000000000000000000000000000000000000000000000000000000000000100 | 247 | 100 in hex = 256 โฆ or 100 in decimal = 256: reading the same digits in the wrong base is the other classic disaster |
2255 | 8000000000000000000000000000000000000000000000000000000000000000 | 0 | A single dropped zero halves the value; the address changes completely |
| demo key | 0824c314772b2c2859c889471390a36bf66e53a1ca1642f96f0f2c9307a171ca | 4 | 824c314โฆ is a different 32-byte key (its first byte would become 0x82) |
The demo key illustrates the subtlety: it has 0 leading zero bytes but
4 leading zero bits, because its first byte is 0x08. Both counts are
reported on this page, and mixing them up is the most common mistake when people hand-type binary keys.
5. Entropy, bit balance and Hamming weight
The Hamming weight of a key is simply how many of its 256 bits are 1. For a
uniformly random key each bit is an independent fair coin, so the weight follows a binomial distribution
with mean and spread:
So roughly 68 % of random keys land in 120โ136, and 99.7 % in 104โ152. The demo
key's weight is 116 โ 1.5 ฯ below the mean, entirely unremarkable. What matters is that you
did not choose it: a key with a deliberately balanced weight has less than 256 bits of entropy,
because you excluded most of the space.
| Bit pattern | Hamming weight | Valid key? | Practical status |
|---|---|---|---|
all zeros (256 ร 0) | 0 | no | k = 0 is the point at infinity; rejected with "Private key 0 is invalid" |
a single 1 in the last position | 1 | yes | k = 1; its P2PKH address is 1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH and is empty because everyone watching drained it years ago |
a single 1 in the first position | 1 | yes | k = 2255 = 57896044618658097711785492504343953926634992332820282019728792003956564819968, address 18h7RmwXCTYX69z9S2Hc9gs8ET7SUN7YG5 โ "large" is not "strong" |
| demo key | 116 | yes | Indistinguishable from random |
all ones (256 ร 1) | 256 | no | 2256โ1 exceeds the curve order n; rejected |
People occasionally "improve" a key by flipping bits until exactly half are ones. That destroys entropy:
the set of 256-bit strings with exactly 128 ones has C(256,128) โ 2251.6 members,
so the balanced-key space is about 20 times smaller than the full space โ and far more importantly, an
attacker who guesses that you did this gets to skip every unbalanced key. Uniform randomness from a CSPRNG
is the only correct construction; any human "adjustment" is a reduction.
6. How key-search programs exploit known bit patterns
Brute force against a full 256-bit key is hopeless: 2256 candidates. Search
programs do not attack random keys; they attack keys whose shape is known. Three shapes are common,
and all three are visible in the binary representation of a key:
| What is known about the key | Candidate space | Cost with the best general algorithm |
|---|---|---|
| Nothing (uniformly random 256-bit key) | 2256 | โ 2128 group operations (Pollard's rho) โ infeasible |
Top t bits are zero, i.e. k < 2256โt | 2256โt | โ 2(256โt)/2 point additions (Pollard's kangaroo), plus memory for BSGS |
An exact range [a, b] of width w | w | โ โw point additions โ this is why interval keys ("puzzle" keys) fall first |
Bottom t bits are zero, i.e. k is a multiple of 2t | 2256โt | The same kangaroo bound, after dividing through by 2t |
| A human-recognisable pattern (a repeated byte, a counter, a date) | as small as you can guess | Dictionary/enumeration: seconds to hours |
Concretely: a key with the top 128 bits known to be zero leaves 2128 candidates and
costs about 264 point additions โ still out of reach today. A key with the top 200
bits zero leaves 256 candidates, about 228 โ 268 million
additions: a single GPU for minutes. That is the actual reason the well-known "puzzle" addresses are emptied
so quickly โ their keys are known to be small, so the search is over an interval, not over the space.
Any rule that shrinks the search space โ "256 bits but only the last 64 matter", "it's a famous constant", "I typed 1 and pressed 0 forty times" โ reduces your security from 256 bits to whatever the rule leaves. And because Bitcoin addresses are public and permanently watchable, an attacker does not even need to be fast in absolute terms: they need to be faster than you are at spending. Keys built from patterns are swept in the same block as the deposit.
7. Worked example
The 256 bits below are the demo key, and every hex, WIF and address value in this table is produced live by this page:
| Step | Value |
|---|---|
| Bits (first 64 of 256) | 00001000 00100100 11000011 00010100 01110111 00101011 00101100 00101000 |
| Bit length / byte length | 256 bits / 32 bytes / 64 hex digits |
| Hamning weight (ones) | 116 (mean 128, ฯ 8 โ 1.5 ฯ low) |
| Leading zero bits / trailing zero bits | 4 / 1 |
| HEX key | 0824c314772b2c2859c889471390a36bf66e53a1ca1642f96f0f2c9307a171ca |
| Decimal | 3683455675284633286911943861444039993120875154046227415438637967083965608394 |
| Compressed WIF | KwVYL77Lcs1ckM39NvGjrtfKhU4KKdR2iB9Wq2FSMN6rbGK5tVqG |
| Compressed public key | 02ff812e26116a9aa140abe629e7f8a38401653caf925119def59ed3758c67ee80 |
| hash160 (compressed) | 21f57b6debcfc5b67182dfb4af1641f0a8189012 |
| P2PKH (C) | 146ZNjH7XTXnMd1ofe3z7CL2i8WM7N2UqT |
| P2SH-P2WPKH (S) | 3DZT76KyKyc5zkzvLugP8umgt4RPY4XPQw |
| P2WPKH (W) | bc1qy86hkm0telzmvuvzm76279jp7z5p3yqjnaerk6 |
| P2TR (T) | bc1pmsrhxnvmj8tjxxu9wj69ntvwvhvr28qufyc26tshz3rjj777tx3sh54u63 |
Two facts worth internalising from this table. First, flipping the final 0 bit to
1 would change the private key by one, and would change every single derived value โ the public
key, both hashes and all ten addresses โ beyond recognition. There is no "almost the same key" in Bitcoin.
Second, the visual structure of the bits (00001000 00100100 โฆ) tells you nothing about the
address: the mapping from bits to address is deliberately unstructured, which is what stops an attacker from
searching "nice-looking" keys instead of the whole space.
8. What comes next in the chain
- HEX private key โ everything โ the hub page, all ten addresses at once.
- Decimal private key โ the same key as one big integer.
- Base64 private key โ for wallets that export raw bytes as text.
- Private key โ compressed public key โ where the bits become a curve point.
- BIP39 mnemonic โ BIP32 child key โ how a safe key is generated in the first place, instead of typed as bits.
9. Security notes
- Binary is the most dangerous representation to handle by hand. One missing or extra
0shifts everything after it; there is no checksum and no structure to notice. If you must move a key between machines, move it as a WIF (which carries a checksum) rather than as bits. - Copy-paste, never retype. A 256-character string is beyond reliable human transcription; every character has a 1-in-2 chance of being wrong if you guess.
- This page is a teaching tool. It has no key generation, no wallet and no storage. Any key you type here should be considered public from the moment you type it.
- Bit-pattern "optimisation" is a self-inflicted attack. Fixed prefixes, repeated nibbles, low weights and round numbers are all first-class targets for the algorithms in section 6.
- Entropy cannot be seen in the bits. A key whose binary looks wonderfully random can
still be
SHA256("hunter2"). The visual test proves nothing; only the generation process does.
10. Common mistakes
- Entering 255 or 257 bits. Both are rejected or padded in ways that change the key. Count the characters (or let the page report the bit length, which it does).
- Right-padding instead of left-padding. Bits are written most-significant first; adding
0on the right multiplies by 2, adding it on the left does nothing at all. - Reading the bits backwards. A big-endian byte order applies to key material; reversing it produces a different valid key with a different address.
- Assuming "all zeros" is a weak key rather than an invalid one. It is rejected outright:
0 ยท Ghas no coordinates. - Assuming "all ones" is the strongest key.
2256โ1is larger than the curve order and is rejected too. - Confusing bits with bytes when counting length. "256" is neither; the key is 256 bits, 32 bytes and 64 hex digits.
- Thinking the binary view is a different key. It is the same integer; only the page's input format differs.
11. Quick reference
| Item | Value / rule |
|---|---|
| Input | 1โ256 characters of 0/1; spaces, newlines, colons, dashes and underscores ignored |
| Rejected input | any other character (Not a valid binary string), or more than 256 bits (Binary input exceeds 256 bits) |
| Short input | Padded on the left to a byte boundary, then to 32 bytes โ 1 is the key 1 |
| Valid key range | 1 โฆ nโ1; all-zeros and all-ones are both invalid |
| Expected Hamming weight | 128 ยฑ 8 for random keys (demo key: 116) |
| Byte order of key material | Big-endian (most significant byte first) |
| Byte order of consensus data | Little-endian (amounts, indexes, versions, lengths) |
| Reversible? | Bits โ hex โ decimal is lossless; key โ address is not |