Private Key Tools

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.

Digits only; spaces, commas and underscores are stripped first (3 683 455… = 3,683,455… = 3683455…). The value must be in [1, n−1] where n = 115792089237316195423570985008687907852837564279074904382605163141518161494337, so at most 78 digits.
No input yet

Enter a value above and press Convert. Not sure what to type? Press “Use example” to load the sample from the placeholder.

How it works

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.

khex = base10→base16( kdec )   then   P = k · G
decimal integer→ strip separators→ radix conversion→ 32-byte hex (left-padded)→ WIF, public keys, hash160→ 10 addresses

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:

k = Σ di · bi   (b = 10 for decimal, b = 16 for hex)

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.

BaseDigits usedDigits for this keyOne digit carriesGood for
2 (binary)0 12561 bitSeeing the curve's own arithmetic; bit-pattern analysis
10 (decimal)0–976log₂(10) ≈ 3.32 bitsHuman counting, range checks, "puzzle" keys
16 (hexadecimal)0–9 a–f64exactly 4 bits (one nibble)Byte-aligned display; the industry default
58 (Base58)alphanumerics minus 0OIl51–52 (with version byte + checksum)log₂(58) ≈ 5.86 bitsWIF and 1…/3… addresses
32 (bech32 charset)32 chars, chosen to avoid look-alikes42–62 (with hrp + checksum)exactly 5 bitsbc1q…/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.

What this page is not

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:

QuantityDecimal
Smallest valid key1
Largest valid key: n−1115792089237316195423570985008687907852837564279074904382605163141518161494336
Curve order n — invalid115792089237316195423570985008687907852837564279074904382605163141518161494337
n+1 — invalid, behaves like 1 if a library lets it through115792089237316195423570985008687907852837564279074904382605163141518161494338
The largest 256-bit number, 2256−1 — invalid115792089237316195423570985008687907853269984665640564039457584007913129639935
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 twoDecimal valueHex (32 bytes)Where you meet it
2255578960446186580977117854925043439539266349923328202820197287920039565648199688000…0000The first bit of a full-width key; the smallest key whose decimal form has 77 digits
21283402823669209384634633746074317682114560000…0001 0000…0000The classic "half of a 256-bit space" marker; also 2128 group operations, the security level of the curve
264184467440737095516160000…0001 0000…0000One past the largest 64-bit unsigned integer — the point where 64-bit arithmetic overflows
282560000…0100"The key is 256" and "the key is 256 bits" are different statements
2010000…0001The 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:

TypeLargest exact valueWhat 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.
Silent truncation is how keys get destroyed

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:

k = 1  →  0000000000000000000000000000000000000000000000000000000000000001  (31 leading zero bytes)

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 inputHex after paddingLeading zero bytesLeading zero bitsValid key?
00000…000032256no — point at infinity
10000…000131255yes
2560000…010030247yes
demo key0824c314…04yes
2256−1ffff…ffff00no — 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)
110000…00011BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH
220000…00021cMh228HTCiwS8ZsaakH8A8wze1JR5ZsP
340000…00041JtK9CQw1syfWj1WtFMWomrYdV3W2tWBF9
480000…00081EhqbyUMvvs7BfL8goY6qcPbD6YKfPqb7e
5160000…001019p7ktDbdJnmV4YLC7zQ37RsYczMZJmd6q
6320000…00201Q3pVMPLvKRNudhqz7uecd7C3iddUJLs21
7640000…004014raEyLewYMk4Xqg76xJQxEygnhWhx6mUQ
81280000…00801CAE6ej7VyAhgTtL1AYKTEByRJaCZKg8XM
105120000…02001M8az82AhB8WC9NyShQMoYK7E7wam8TeN9
1220480000…08001NDaJQKUp9TaKXgLLnM4d5ukP1WcmhDPhV
16327680000…80001GkFyhEBkkwUT9keTB8qMp2t4NQi8YcVGf
205242880000…0008 00001FFtp4xWbyoR1e4ZCZmwnx9XR6C6SPAQS

Two lessons follow, and they explain why such keys are emptied almost instantly:

"But my number isn't a power of two"

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):

StepValue
Decimal input3683455675284633286911943861444039993120875154046227415438637967083965608394
Hex (32 bytes, no padding needed)0824c314772b2c2859c889471390a36bf66e53a1ca1642f96f0f2c9307a171ca
Binary (first byte)00001000 — the value begins with 4 zero bits
Compressed WIFKwVYL77Lcs1ckM39NvGjrtfKhU4KKdR2iB9Wq2FSMN6rbGK5tVqG
Uncompressed WIF5HssbguBnjbaUVZCsH9YuzUG7T4vYQf51iiodi4izdVy6aVNekU
Compressed public key02ff812e26116a9aa140abe629e7f8a38401653caf925119def59ed3758c67ee80
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 typeWhat happensWhy
3 683 455 … / 3,683,455,… / 3_683_455…Accepted; separators removed before conversionReadability only — the same integer
0Private 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−1Value is 260 bits, which exceeds the expected 256 bitsIt cannot be serialized as 32 bytes at all
1.5 or -5Not a valid decimal integer: 1.5Only digits (plus separators) are accepted; there is no fractional or negative key
empty inputThe page stays in its "no input yet" stateEmpty input never falls back to the demo value

9. What comes next in the chain

10. Security notes

11. Common mistakes

12. Quick reference

ItemValue / rule
InputDecimal integer; spaces, commas and underscores ignored
Valid range1 … 115792089237316195423570985008687907852837564279074904382605163141518161494336
Decimal digits in range1–78 digits (demo key: 76)
Output widthAlways 64 hex digits / 32 bytes, left-padded
Reversible?Yes — decimal ⇄ hex is lossless; the public key step is not
PHP native integer limit9223372036854775807 (263−1) — use GMP instead
JSON/JS safe integer limit253 = 9007199254740992