<p>There is also a bash (or zsh) shell script to convert from WIF to hexadecimal format: <a href="https://gist.github.com/GregTonoski/fbe2740391a366add4bfcefded00c5c4" rel="nofollow noreferrer">https://gist.github.com/GregTonoski/fbe2740391a366add4bfcefded00c5c4</a></p>
<p>Simply run the script like in the example:</p>
<pre><code>$ bash Bitcoin_WIF_into_hex.bash &quot;L3wB8ytuxNS3SPX2CJnHqK48Zzqj1AnayDTrJomvNPDxuKvHyvpT&quot; &gt; private_key_bitcoin.hex
</code></pre>

CC BY-SA 4.0
2023-06-04T17:14:05.273Z
2023-06-04T17:14:05.273Z
Greg Tonoski
<p>Using <a href="https://github.com/mcdallas/cryptotools" rel="nofollow noreferrer">this</a> python library (I am the author)</p>
<pre><code>&gt;&gt;&gt; from cryptotools import PrivateKey

&gt;&gt;&gt; prv = PrivateKey.from_wif('5KUkQNKHA9cVmhSyKuNmop7r83DN2fMhPtNUW843Q6JxqRddEVz')
&gt;&gt;&gt; prv.hex()
'db07a0c6c98c7a2b5cdc19cd4431a05908a40424d6d1ff20eac9cb2f9488e12d'
</code></pre>
<p>If the key is too large</p>
<pre><code>&gt;&gt;&gt; PrivateKey.from_int(1 &lt;&lt; 260)
</code></pre>
<p>it will throw an error</p>
<pre><code>AssertionError: Key larger than Curve Order
</code></pre>

CC BY-SA 4.0
2021-07-08T12:25:11.317Z
thank you mike is there any way to import the private key which fall out of range of elliptical curve
Muhammad Adnan Alam
CC BY-SA 4.0
2021-07-08T18:07:36.600Z
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
CC BY-SA 4.0
2021-07-08T11:35:07.347Z
2021-07-08T11:35:07.347Z
Mike D
<p>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 ?</p>

<private-key><python><wallet-import-format>
how to convert WIF key return to HEX format
Muhammad Adnan Alam
# how to convert WIF key return to HEX format

(Asked by: username_0 on 2021-07-08)

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 ?

**Tags:** private-key, python, wallet-import-format


---

## 2 answers

### Answer by username_2 on 2021-07-08. Score: 4 | Accepted answer

Using [this](https://github.com/mcdallas/cryptotools) python library (I am the author)

```
>>> from cryptotools import PrivateKey

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

```

If the key is too large

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

```

it will throw an error

```
AssertionError: Key larger than Curve Order

```

> **Comments:**
> **username_0**: thank you username_2 is there any way to import the private key which fall out of range of elliptical curve  
> **username_2**: No. If you have a number that's too large you should first find it's congruent modulo N and then import that  

---

### Answer by username_1 on 2023-06-04. Score: 0

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

Simply run the script like in the example:

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

```


---

