Decimal private key → HEX, WIF and addresses
Type the private key the way a human writes numbers — one big decimal integer — and this page converts it into the canonical 256-bit HEX form, then derives both WIFs, both public keys, both hash160 values and all ten addresses. Spaces, commas and underscores are ignored.
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 takes the private key written the way a human writes numbers — as an ordinary decimal integer
— and converts it into the canonical 256-bit hexadecimal form, then runs the whole derivation from there.
Spaces, commas and underscores are stripped before conversion, because 3 683 455 675 … and
3,683,455,675… and 3683455675… are the same number and a human reader needs the
separators while a computer does not.
1. Decimal and hex are the same number
A private key is an integer, and an integer has exactly one value. "Decimal" and "hexadecimal" are not properties of the key; they are choices of how to spell it. The value is a weighted sum of digits, where the weight of each position is a power of the base:
For the demo key the first decimal digit is 3 in the 76th position, contributing
3 × 1075; the hex form starts with 08, contributing
0 × 1663 + 8 × 1662. Different arithmetic, identical value.
| Base | Digits used | Digits for this key | One digit carries | Good for |
|---|---|---|---|---|
| 2 (binary) | 0 1 | 256 | 1 bit | Seeing the curve's own arithmetic; bit-pattern analysis |
| 10 (decimal) | 0–9 | 76 | log₂(10) ≈ 3.32 bits | Human counting, range checks, "puzzle" keys |
| 16 (hexadecimal) | 0–9 a–f | 64 | exactly 4 bits (one nibble) | Byte-aligned display; the industry default |
| 58 (Base58) | alphanumerics minus 0OIl | 51–52 (with version byte + checksum) | log₂(58) ≈ 5.86 bits | WIF and 1…/3… addresses |
| 32 (bech32 charset) | 32 chars, chosen to avoid look-alikes | 42–62 (with hrp + checksum) | exactly 5 bits | bc1q…/bc1p… addresses |
The reason hex is the convention is in the third column: base 16 is the only one of these that lines up with the machine's own unit. Four bits are one hex digit, eight bits are two hex digits, so a 32-byte key is exactly 64 hex digits, and every byte boundary is visible by counting.
It is not an encryption step and not a "conversion of the key". No hash, no KDF and no checksum is
applied when going from decimal to hex — the mapping is a bijection on the integers and is fully
reversible. The only irreversible parts of this page are the ones that come later: P = k·G
(one-way by the discrete-log assumption) and the SHA-256/RIPEMD-160 hashing inside the addresses.
2. How the conversion actually works
Two textbook algorithms do the job. Both are exact; they differ in how much scratch memory they need and how they feel to implement.
Repeated division ("remainder method")
digits = "0123456789abcdef"
out = ""
while n > 0:
n, r = divmod(n, 16) # r in 0..15
out = digits[r] + out # prepend
return out or "0"
Produces the answer from the least significant end, so each new digit must be pushed to the front (or collected and reversed at the end). One big-integer division per output digit: 64 divisions for a 32-byte key.
Horner's method (left-to-right)
acc = 0
for ch in decimal_string:
acc = acc * 10 + digit(ch)
# acc is now the integer value;
# repeat the same trick with base 16
# to emit hex digits.
Evaluates the polynomial from the most significant digit down, using one multiply and one add per
input digit. This is what big-integer libraries (GMP, bcmath, Java's BigInteger, Python's
int) do internally: 76 multiply-adds to read the decimal, 64 divisions to write the hex.
Both algorithms are equally correct, and both are linear in the number of digits for
fixed-size bases. The reason this page can do it at all in PHP is that the work is delegated to GMP:
gmp_init("368345…", 10) reads the decimal string directly, and gmp_strval(n,
16) writes the hex out. Doing it by hand with intval() would silently destroy the key
— see the next section.
3. Why 256 bits, and where the boundaries are
secp256k1's point group has order n, which is a 256-bit number just below
2256. Valid private keys are the integers 1 … n−1. Written out in full,
because these are the exact numbers a validator compares against:
| Quantity | Decimal |
|---|---|
| Smallest valid key | 1 |
| Largest valid key: n−1 | 115792089237316195423570985008687907852837564279074904382605163141518161494336 |
| Curve order n — invalid | 115792089237316195423570985008687907852837564279074904382605163141518161494337 |
| n+1 — invalid, behaves like 1 if a library lets it through | 115792089237316195423570985008687907852837564279074904382605163141518161494338 |
| The largest 256-bit number, 2256−1 — invalid | 115792089237316195423570985008687907853269984665640564039457584007913129639935 |
| 2256 (does not fit in 32 bytes) | 115792089237316195423570985008687907853269984665640564039457584007913129639936 |
Only three decimal digits distinguish n−1 from n in that table. The closed
invalid interval [n, 2256−1] contains
432420386565659656852420866394968145599 integers — the span between its two endpoints is
432420386565659656852420866394968145598. Dividing 2256 by that count gives
267776665566007192515705986938822075896, so the band is only about one
2.678 × 1038th of the 32-byte space. That is why nobody notices the boundary until a validator
rejects an input.
| Power of two | Decimal value | Hex (32 bytes) | Where you meet it |
|---|---|---|---|
| 2255 | 57896044618658097711785492504343953926634992332820282019728792003956564819968 | 8000…0000 | The first bit of a full-width key; the smallest key whose decimal form has 77 digits |
| 2128 | 340282366920938463463374607431768211456 | 0000…0001 0000…0000 | The classic "half of a 256-bit space" marker; also 2128 group operations, the security level of the curve |
| 264 | 18446744073709551616 | 0000…0001 0000…0000 | One past the largest 64-bit unsigned integer — the point where 64-bit arithmetic overflows |
| 28 | 256 | 0000…0100 | "The key is 256" and "the key is 256 bits" are different statements |
| 20 | 1 | 0000…0001 | The smallest valid key; its address is 1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH (compressed) |
4. BigInt: why ordinary integers cannot hold this
Every language's native integer type has a fixed width, and 256 bits is four times the widest one in common use. The consequences are not hypothetical:
| Type | Largest exact value | What happens with a 256-bit key |
|---|---|---|
PHP int (64-bit build) |
9223372036854775807 (263−1) |
Casting the demo key to int saturates at exactly 9223372036854775807. 63 bits of the key are gone and the rest is a constant. |
IEEE-754 double (PHP float, JavaScript number) |
Integers exact up to 253 = 9007199254740992 |
Casting the demo key to float and printing it with sprintf('%.0f', $f) gives 3683455675284633033626393239859223006741653855112843325067765303468422594560 — wrong from the 17th digit onward. (A plain (string) cast prints 3.6834556752846E+75, which hides the corruption.) |
| GMP / bcmath arbitrary precision | limited only by memory | Exact. This is what the page uses. |
The failure mode of native integers is not an error message, it is a wrong number that looks
plausible. A tool that reads your decimal key into a double, derives an address from it and
shows you a balance will confidently tell you the balance of a different key. If you ever
reimplement this, keep the value as a string or an arbitrary-precision integer from the very first
character; never let it pass through intval(), parseInt() or
Number().
5. Width, padding and the leading zeros
A decimal number has no fixed length: 1, 256 and the demo key are all "a
private key" as far as decimal notation is concerned. Bitcoin, however, serializes a key as exactly 32
bytes, so the value must be left-padded with zero bits until it fills the field:
The demo key happens to need no padding at all: its 64th hex digit from the right sits in the top
nibble position, so its byte count is exactly 32 and its leading-zero-byte count is 0 — even though its
first four bits are 0000. This distinction (leading zero bits vs leading zero bytes)
is the single most common source of confusion when people hand-write binary keys.
| Decimal input | Hex after padding | Leading zero bytes | Leading zero bits | Valid key? |
|---|---|---|---|---|
0 | 0000…0000 | 32 | 256 | no — point at infinity |
1 | 0000…0001 | 31 | 255 | yes |
256 | 0000…0100 | 30 | 247 | yes |
| demo key | 0824c314… | 0 | 4 | yes |
| 2256−1 | ffff…ffff | 0 | 0 | no — exceeds n |
6. Round numbers: the shape of the famous "puzzle" keys
The Bitcoin ecosystem has a well-known set of funded addresses — the "puzzle" — whose private
keys are not random 256-bit numbers at all: key number i is a number in the interval
[2i−1, 2i). In other words the top 256 − i bits are known to
be zero. Those keys are exactly the "small round decimal numbers" this page is about, and the table below
shows the first ones with the mainnet P2PKH address each one derives (all values computed by this tool):
| # | Key (decimal) | Key (hex, 64 digits) | P2PKH address (compressed) |
|---|---|---|---|
| 1 | 1 | 0000…0001 | 1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH |
| 2 | 2 | 0000…0002 | 1cMh228HTCiwS8ZsaakH8A8wze1JR5ZsP |
| 3 | 4 | 0000…0004 | 1JtK9CQw1syfWj1WtFMWomrYdV3W2tWBF9 |
| 4 | 8 | 0000…0008 | 1EhqbyUMvvs7BfL8goY6qcPbD6YKfPqb7e |
| 5 | 16 | 0000…0010 | 19p7ktDbdJnmV4YLC7zQ37RsYczMZJmd6q |
| 6 | 32 | 0000…0020 | 1Q3pVMPLvKRNudhqz7uecd7C3iddUJLs21 |
| 7 | 64 | 0000…0040 | 14raEyLewYMk4Xqg76xJQxEygnhWhx6mUQ |
| 8 | 128 | 0000…0080 | 1CAE6ej7VyAhgTtL1AYKTEByRJaCZKg8XM |
| 10 | 512 | 0000…0200 | 1M8az82AhB8WC9NyShQMoYK7E7wam8TeN9 |
| 12 | 2048 | 0000…0800 | 1NDaJQKUp9TaKXgLLnM4d5ukP1WcmhDPhV |
| 16 | 32768 | 0000…8000 | 1GkFyhEBkkwUT9keTB8qMp2t4NQi8YcVGf |
| 20 | 524288 | 0000…0008 0000 | 1FFtp4xWbyoR1e4ZCZmwnx9XR6C6SPAQS |
Two lessons follow, and they explain why such keys are emptied almost instantly:
- A known interval shrinks the search. If you know the key lies in
[2i−1, 2i), the candidates number2i−1instead of2256. Against a known interval, Pollard's kangaroo algorithm costs on the order of2i/2point additions: fori = 40that is about a million operations, fori = 64about 232 (a laptop-week), fori = 128it is 264 and out of reach. The low members of this table are arithmetic exercises, not puzzles. - Recognisable addresses make it worse. These keys are published, so their addresses are
on a public list: a sweeper does not search at all, but watches the addresses and spends in the same
block a deposit lands in. A "clever" key such as
nitself or2255(which derives18h7RmwXCTYX69z9S2Hc9gs8ET7SUN7YG5) is in the same category.
Then it is worse: a human-invented number has far less entropy than 256 bits, and the attacker guesses the pattern rather than searching the space. The only defensible source of a key is a CSPRNG or a BIP39 mnemonic.
7. Worked example
Everything in this table is produced live by the page from the decimal sample
3683455675284633286911943861444039993120875154046227415438637967083965608394 (76 digits,
about 3.18 % of the way up the valid range):
| Step | Value |
|---|---|
| Decimal input | 3683455675284633286911943861444039993120875154046227415438637967083965608394 |
| Hex (32 bytes, no padding needed) | 0824c314772b2c2859c889471390a36bf66e53a1ca1642f96f0f2c9307a171ca |
| Binary (first byte) | 00001000 — the value begins with 4 zero bits |
| Compressed WIF | KwVYL77Lcs1ckM39NvGjrtfKhU4KKdR2iB9Wq2FSMN6rbGK5tVqG |
| Uncompressed WIF | 5HssbguBnjbaUVZCsH9YuzUG7T4vYQf51iiodi4izdVy6aVNekU |
| Compressed public key | 02ff812e26116a9aa140abe629e7f8a38401653caf925119def59ed3758c67ee80 |
| hash160 (compressed) | 21f57b6debcfc5b67182dfb4af1641f0a8189012 |
| P2PKH (C) | 146ZNjH7XTXnMd1ofe3z7CL2i8WM7N2UqT |
| P2PKH (U) | 16kR3eiswUY6tmGnxZhwQmW6LAvTLGWG2G |
| P2SH-P2WPKH (S) | 3DZT76KyKyc5zkzvLugP8umgt4RPY4XPQw |
| P2WPKH (W) | bc1qy86hkm0telzmvuvzm76279jp7z5p3yqjnaerk6 |
| P2TR (T) | bc1pmsrhxnvmj8tjxxu9wj69ntvwvhvr28qufyc26tshz3rjj777tx3sh54u63 |
| Testnet P2PKH (C) | micWfnN6LUy38jVRPD2Mw7YMa873zjixGw |
| Testnet P2WPKH (W) | tb1qy86hkm0telzmvuvzm76279jp7z5p3yqjemzsdf |
8. Input validation, and the messages you will see
| You type | What happens | Why |
|---|---|---|
3 683 455 … / 3,683,455,… / 3_683_455… | Accepted; separators removed before conversion | Readability only — the same integer |
0 | Private key 0 is invalid: the range is [1, n-1] | 0 · G has no coordinates |
115792089237316195423570985008687907852837564279074904382605163141518161494337 (= n) | Private key is >= the secp256k1 curve order n… | Valid 32-byte number, invalid key |
a 78-digit number above 2256−1 | Value is 260 bits, which exceeds the expected 256 bits | It cannot be serialized as 32 bytes at all |
1.5 or -5 | Not a valid decimal integer: 1.5 | Only digits (plus separators) are accepted; there is no fractional or negative key |
| empty input | The page stays in its "no input yet" state | Empty input never falls back to the demo value |
9. What comes next in the chain
- HEX private key → everything — the hub page: all representations, both WIFs, all ten addresses in one screen.
- Binary private key — the same key as 256 bits, with bit positions.
- Base64 private key — for wallet exports that are neither hex nor decimal.
- Private key → compressed public key — the step after the conversion.
10. Security notes
- Decimal keys are still keys. Writing a secret in base 10 hides nothing; a key published as a decimal integer is as exposed as the WIF.
- Copy the exact digit count. A 76-digit key with one digit missing is a different key, usually a valid one, and it will show a balance of zero while your real coins sit untouched — or, far worse, an attacker's key that was generated by a search for near-miss typos.
- Never round or reformat. Thousands separators are cosmetic, but "3.68 × 1075" is information loss. Keep keys as strings, and back them up as a WIF or a BIP39 mnemonic rather than a number you retyped.
- Remember the point of the exercise. Everything on this page is public mathematics: anyone who has the decimal key can spend the coins, and anyone who has an address cannot find the key. That asymmetry is the whole security model.
11. Common mistakes
- Treating the decimal form as "more secret". It is the same value; obscurity is not encryption.
- Using
intval()/Number()/parseInt(). They truncate at 63 or 53 bits and return a valid-looking wrong number. - Confusing 256 (a number) with 256 bits (a width). The key
256is0000…0100, a perfectly ordinary low-entropy key. - Assuming the maximum is fixed.
2256−1is not a key;n−1is. The upper bound is the curve order, not the width of the field. - Padding with the wrong side. Padding is always on the left. Appending zeros multiplies the value by 16.
- Pasting a WIF or hex string here. A
K…string or0824c314…is not a decimal integer and will be rejected — use the matching page.
12. Quick reference
| Item | Value / rule |
|---|---|
| Input | Decimal integer; spaces, commas and underscores ignored |
| Valid range | 1 … 115792089237316195423570985008687907852837564279074904382605163141518161494336 |
| Decimal digits in range | 1–78 digits (demo key: 76) |
| Output width | Always 64 hex digits / 32 bytes, left-padded |
| Reversible? | Yes — decimal ⇄ hex is lossless; the public key step is not |
| PHP native integer limit | 9223372036854775807 (263−1) — use GMP instead |
| JSON/JS safe integer limit | 253 = 9007199254740992 |