any one knows how to convert WIF key return to hex format please also let me know if the private key is out side range of ecc then how to import it to some wallet ?

2 Answers 2


Using this python library (I am the author)

>>> from cryptotools import PrivateKey

>>> prv = PrivateKey.from_wif('5KUkQNKHA9cVmhSyKuNmop7r83DN2fMhPtNUW843Q6JxqRddEVz')
>>> prv.hex()

If the key is too large

>>> PrivateKey.from_int(1 << 260)

it will throw an error

AssertionError: Key larger than Curve Order
  • thank you mike is there any way to import the private key which fall out of range of elliptical curve Jul 8, 2021 at 12:25
  • No. If you have a number that's too large you should first find it's congruent modulo N and then import that
    – Mike D
    Jul 8, 2021 at 18:07

There is also a bash (or zsh) shell script to convert from WIF to hexadecimal format: https://gist.github.com/GregTonoski/fbe2740391a366add4bfcefded00c5c4

Simply run the script like in the example:

$ bash Bitcoin_WIF_into_hex.bash "L3wB8ytuxNS3SPX2CJnHqK48Zzqj1AnayDTrJomvNPDxuKvHyvpT" > private_key_bitcoin.hex

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.