<p>I'd check out the python library PyBitcoin (<a href="https://github.com/blockstack/pybitcoin" rel="noreferrer">https://github.com/blockstack/pybitcoin</a> or "pip install pybitcoin").</p>

<p>It's pretty simple to get the address from the wif private key:</p>

<pre><code>&gt;&gt;&gt; from pybitcoin import BitcoinPrivateKey
&gt;&gt;&gt; private_key = BitcoinPrivateKey()
&gt;&gt;&gt; private_key.public_key().address()
'1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T'
</code></pre>

<p>You can also derive a private key object from it's raw hex representation:</p>

<pre><code>&gt;&gt;&gt; private_key_2 = BitcoinPrivateKey('91149ee24f1ee9a6f42c3dd64c2287781c8c57a6e8e929c80976e586d5322a3d')
</code></pre>

<p>P.S. This library also works with Litecoin, Namecoin and a bunch of other coins.</p>

<p>Disclosure: I'm one of the creators.</p>

CC BY-SA 3.0
2014-02-25T01:54:04.497Z
Thanks! If only you had check balance and send functionality. Would be awesome.
HaltingState
CC BY-SA 3.0
2014-02-25T05:17:07.333Z
Glad to hear you like it! We'll add that functionality soon enough and of course we welcome all contributions.
Ryan Shea
CC BY-SA 3.0
2017-09-01T18:50:17.173Z
I couldn't get the code above to work. However, poking through the source code I found the following that worked: >>> from pycoin.key import Key
>>> k = Key.from_text("<yourWIFhere>") >>> k.address()
Keir Finlow-Bates
CC BY-SA 3.0
2014-01-03T19:02:21.793Z
2016-02-18T00:01:45.090Z
2016-02-18T00:01:45.090Z
Ryan Shea
<p>Offhand it looks like <a href="https://github.com/richardkiss/pycoin" rel="nofollow noreferrer"><code>pycoin</code></a> is more active than<code>pybitcoin</code>. So I'll put Keir Finlow-Bates' code from a comment above into an answer by itself:</p>

<pre><code>from pycoin.key import Key
k = Key.from_text("&lt;yourWIFhere&gt;")
k.address()
</code></pre>

CC BY-SA 3.0
2017-12-28T23:59:15.403Z
2017-12-28T23:59:15.403Z
nealmcb
<p>If I understand your problem correctly and you just want to calculate the address of a given private key, you could use brainwallet.org for that. The website is Javascript-based so you can just load the website and disconnect from the internet. 
If you want it even safer, you could download the source code and open the website locally on an offline machine. </p>

<p>Brainwallet.org has quite a lot little useful address tools. </p>

CC BY-SA 4.0
2020-05-07T23:51:42.257Z
It seems like brainwallet.org is abandoned
Gabe
CC BY-SA 3.0
2014-01-03T20:07:12.563Z
2014-01-03T20:07:12.563Z
Steven Roose
<p>An updated version of @nealmcb's answer above that I figured out from playing with the pycoin API. This solution works with the recent versions of pycoin, which has changed a lot over the years it seems.</p>
<pre><code>from pycoin.symbols.btc import network
k = network.parse.private_key(&quot; ... &quot;)
k.address()
</code></pre>

CC BY-SA 4.0
2021-06-23T01:38:12.040Z
2021-06-23T01:38:12.040Z
rplevy
<p>its very simple.</p>

<p>just download ofline bitaddress.org page (for security, other wise online will also work, but there could be security risk )and click on wallet details  tab.</p>

<p>enter your private key and you will get your corresponding public key.</p>

CC BY-SA 3.0
2015-06-22T17:25:55.483Z
They want to run a script, not do a manual process.
morsecoder
CC BY-SA 3.0
2015-06-22T14:57:25.490Z
2015-06-22T14:57:25.490Z
DIn
<p>You can try tool <a href="https://github.com/10gic/btc-address-dump" rel="nofollow noreferrer">btc-address-dump</a>, installation: <code>pip3 install btc-address-dump</code>.</p>
<p>Dump btc address from hex private key:</p>
<pre><code>$ btc_address_dump c7ac679b56f50bfd54dd924fe45a8dca7a1c2dced254b03dac22afc03adb9127
private key (hex) = c7ac679b56f50bfd54dd924fe45a8dca7a1c2dced254b03dac22afc03adb9127
private key (WIF) = 5KLDyKtrScLYsKMJzVCt8Mf6Nn9DEV7V3fg8njfSZnqe7ZEMqzK
private key (WIF compressed) = L3urFcPsE2yHf5zeQjVSfUB8j8FEzX5cnmhjNsJfqjKgowPP4tmg
public key (uncompressed) = 044cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1087190d91e26af594e3f8ecd3f4d3596c03c45d3b235da916903c930c6593cc4
public key (compressed) = 024cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1
address (p2pkh uncompressed) = 1Q5RqZctfcNkTPad2tuJSREByd2gB8xs63
address (p2pkh compressed) = 12W36tm2jnreFiYdrzfE6cvRaKRbicEpnA
address (p2wpkh) = bc1qzp6lz6zy9p7k68r0a7lzfpkdxvj3yapynzuatt
</code></pre>
<p>Dump btc address from WIF private key:</p>
<pre><code>$ btc_address_dump 5KLDyKtrScLYsKMJzVCt8Mf6Nn9DEV7V3fg8njfSZnqe7ZEMqzK
private key (hex) = c7ac679b56f50bfd54dd924fe45a8dca7a1c2dced254b03dac22afc03adb9127
private key (WIF) = 5KLDyKtrScLYsKMJzVCt8Mf6Nn9DEV7V3fg8njfSZnqe7ZEMqzK
private key (WIF compressed) = L3urFcPsE2yHf5zeQjVSfUB8j8FEzX5cnmhjNsJfqjKgowPP4tmg
public key (uncompressed) = 044cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1087190d91e26af594e3f8ecd3f4d3596c03c45d3b235da916903c930c6593cc4
public key (compressed) = 024cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1
address (p2pkh uncompressed) = 1Q5RqZctfcNkTPad2tuJSREByd2gB8xs63
address (p2pkh compressed) = 12W36tm2jnreFiYdrzfE6cvRaKRbicEpnA
address (p2wpkh) = bc1qzp6lz6zy9p7k68r0a7lzfpkdxvj3yapynzuatt
</code></pre>
<p>Dump btc address from mnemonic words:</p>
<pre><code>$ btc_address_dump &quot;olympic wine chicken argue unaware bundle tunnel grid spider slot spell need&quot;
mnemonic = olympic wine chicken argue unaware bundle tunnel grid spider slot spell need
private key (hex) = c7ac679b56f50bfd54dd924fe45a8dca7a1c2dced254b03dac22afc03adb9127
private key (WIF) = 5KLDyKtrScLYsKMJzVCt8Mf6Nn9DEV7V3fg8njfSZnqe7ZEMqzK
private key (WIF compressed) = L3urFcPsE2yHf5zeQjVSfUB8j8FEzX5cnmhjNsJfqjKgowPP4tmg
public key (uncompressed) = 044cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1087190d91e26af594e3f8ecd3f4d3596c03c45d3b235da916903c930c6593cc4
public key (compressed) = 024cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1
address (p2pkh uncompressed) = 1Q5RqZctfcNkTPad2tuJSREByd2gB8xs63
address (p2pkh compressed) = 12W36tm2jnreFiYdrzfE6cvRaKRbicEpnA
address (p2wpkh) = bc1qzp6lz6zy9p7k68r0a7lzfpkdxvj3yapynzuatt
</code></pre>
<p>Dump btc address from public key:</p>
<pre><code>$ btc_address_dump 024cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1
public key (uncompressed) = 044cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1087190d91e26af594e3f8ecd3f4d3596c03c45d3b235da916903c930c6593cc4
public key (compressed) = 024cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1
address (p2pkh uncompressed) = 1Q5RqZctfcNkTPad2tuJSREByd2gB8xs63
address (p2pkh compressed) = 12W36tm2jnreFiYdrzfE6cvRaKRbicEpnA
address (p2wpkh) = bc1qzp6lz6zy9p7k68r0a7lzfpkdxvj3yapynzuatt
</code></pre>

CC BY-SA 4.0
2021-01-03T17:04:36.043Z
2021-01-03T17:04:36.043Z
lemon
<p><a href="http://github.com/grondilu/bitcoin-bash-tools" rel="nofollow noreferrer">Bitcoin-bash-tools</a> has what you need.</p>

<p>For Python, numtowif() below, from a <a href="http://bitcointalk.org/index.php?topic=84238.msg1205204#msg1205204" rel="nofollow noreferrer">post by forum user</a> flatfly, does that as well:</p>

<pre><code>import hashlib, binascii

t='123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'

def numtowif(numpriv):
 step1 = '80'+hex(numpriv)[2:].strip('L').zfill(64)
 step2 = hashlib.sha256(binascii.unhexlify(step1)).hexdigest()
 step3 = hashlib.sha256(binascii.unhexlify(step2)).hexdigest()
 step4 = int(step1 + step3[:8] , 16)
 return ''.join([t[step4/(58**l)%58] for l in range(100)])[::-1].lstrip('1')

def wiftonum(wifpriv):
 return sum([t.index(wifpriv[::-1][l])*(58**l) for l in range(len(wifpriv))])/(2**32)%(2**256)

def validwif(wifpriv):
 return numtowif(wiftonum(wifpriv))==wifpriv

print numtowif(0x0C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D)
print hex(wiftonum('5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ'))
print validwif('5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ')
print validwif('5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTK')
</code></pre>

<p>Also, Armory client has some C++ that can be compiled and easily <a href="http://bitcointalk.org/index.php?topic=52314.msg931524#msg931524" rel="nofollow noreferrer">accessed from Python</a> which provides this.</p>

CC BY-SA 3.0
2015-10-17T17:58:38.013Z
Well, that 'numtowif()' gave me the key in Wallet Import Format, not the address...
lvella
CC BY-SA 3.0
2016-12-29T21:25:37.713Z
+1 but this code will not work with `Python3`. I've managed to work with it. Thanks.
Chiheb Nexus
CC BY-SA 3.0
2013-03-02T03:57:39.953Z
2017-11-29T15:35:42.310Z
2017-11-29T15:35:42.310Z
Stephen Gornick
<p>I have made paper wallets. And I continually send what bitcoins I get to them. I'm paranoid that I've been sending bitcoins to the paper bitcoin addresses where somehow at sometime my saved private keys got corrupted. So from time to time I want to run a script, python or whatever, to check if my private keys do correspond to the public address that I've been sending bitcoins to. I want an offline solution so things like the satoshi client would not do. Is there a small script written by someone that can solve this?</p>

CC BY-SA 3.0
2013-03-01T21:13:02.743Z
Satoshi doesn't need to be online to generate keys or to import them to your wallet.
Nick ODell
CC BY-SA 3.0
2013-03-01T23:21:30.550Z
I'm sorry for you. This level of paranoia results more often in errors your side, than the risk of getting hacked if you do everything in a normal way...
o0'.
CC BY-SA 3.0
2017-06-08T07:38:33.567Z
For those who want to implement this in their programming language, there is a interactive online tool here http://gobittest.appspot.com/PrivateKey (obviously don't use your real private keys here but get one from Directory.io)
mixdev
CC BY-SA 4.0
2021-06-23T14:39:51.103Z
general warning with self-made paper wallets, make sure when you eventually use this address, you do a clean sweep, moving all the bitcoin from this address at once. If you try a "test" transaction, you may end up losing everything to a change address you don't control.
hedgedandlevered
<wallet><private-key>
How do I get the public bitcoin address from a given private key in wallet import format offline?
user299648
# How do I get the public bitcoin address from a given private key in wallet import format offline?

(Asked by: username_0 on 2013-03-01)

I have made paper wallets. And I continually send what bitcoins I get to them. I'm paranoid that I've been sending bitcoins to the paper bitcoin addresses where somehow at sometime my saved private keys got corrupted. So from time to time I want to run a script, python or whatever, to check if my private keys do correspond to the public address that I've been sending bitcoins to. I want an offline solution so things like the satoshi client would not do. Is there a small script written by someone that can solve this?

**Tags:** wallet, private-key

> **Comments:**
> **username_1**: Satoshi doesn't need to be online to generate keys or to import them to your wallet.  
> **username_2**: I'm sorry for you. This level of paranoia results more often in errors your side, than the risk of getting hacked if you do everything in a normal way...  
> **username_3**: For those who want to implement this in their programming language, there is a interactive online tool here http://gobittest.appspot.com/PrivateKey (obviously don't use your real private keys here but get one from Directory.io)  
> **username_4**: general warning with self-made paper wallets, make sure when you eventually use this address, you do a clean sweep, moving all the bitcoin from this address at once. If you try a "test" transaction, you may end up losing everything to a change address you don't control.  

---

## 7 answers

### Answer by username_15 on 2013-03-02. Score: 4 | Accepted answer

Bitcoin-bash-tools has what you need.
For Python, numtowif() below, from a post by forum user flatfly, does that as well:
import hashlib, binascii

t='123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'

def numtowif(numpriv):
 step1 = '80'+hex(numpriv)[2:].strip('L').zfill(64)
 step2 = hashlib.sha256(binascii.unhexlify(step1)).hexdigest()
 step3 = hashlib.sha256(binascii.unhexlify(step2)).hexdigest()
 step4 = int(step1 + step3[:8] , 16)
 return ''.join([t[step4/(58**l)%58] for l in range(100)])[::-1].lstrip('1')

def wiftonum(wifpriv):
 return sum([t.index(wifpriv[::-1][l])*(58**l) for l in range(len(wifpriv))])/(2**32)%(2**256)

def validwif(wifpriv):
 return numtowif(wiftonum(wifpriv))==wifpriv

print numtowif(0x0C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D)
print hex(wiftonum('5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ'))
print validwif('5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ')
print validwif('5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTK')

Also, Armory client has some C++ that can be compiled and easily accessed from Python which provides this.

> **Comments:**
> **username_16**: Well, that 'numtowif()' gave me the key in Wallet Import Format, not the address...  
> **username_17**: +1 but this code will not work with `Python3`. I've managed to work with it. Thanks.  

---

### Answer by username_5 on 2014-01-03. Score: 8

I'd check out the python library PyBitcoin (https://github.com/blockstack/pybitcoin or "pip install pybitcoin").
It's pretty simple to get the address from the wif private key:
>>> from pybitcoin import BitcoinPrivateKey
>>> private_key = BitcoinPrivateKey()
>>> private_key.public_key().address()
'1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T'

You can also derive a private key object from it's raw hex representation:
>>> private_key_2 = BitcoinPrivateKey('91149ee24f1ee9a6f42c3dd64c2287781c8c57a6e8e929c80976e586d5322a3d')

P.S. This library also works with Litecoin, Namecoin and a bunch of other coins.
Disclosure: I'm one of the creators.

> **Comments:**
> **username_6**: Thanks! If only you had check balance and send functionality. Would be awesome.  
> **username_5**: Glad to hear you like it! We'll add that functionality soon enough and of course we welcome all contributions.  
> **username_7**: I couldn't get the code above to work. However, poking through the source code I found the following that worked: >>> from pycoin.key import Key >>> k = Key.from_text("<yourWIFhere>") >>> k.address()  

---

### Answer by username_8 on 2017-12-28. Score: 3

Offhand it looks like pycoin is more active thanpybitcoin. So I'll put username_7' code from a comment above into an answer by itself:
from pycoin.key import Key
k = Key.from_text("")
k.address()


---

### Answer by username_9 on 2014-01-03. Score: 2

If I understand your problem correctly and you just want to calculate the address of a given private key, you could use brainwallet.org for that. The website is Javascript-based so you can just load the website and disconnect from the internet.
If you want it even safer, you could download the source code and open the website locally on an offline machine.

Brainwallet.org has quite a lot little useful address tools.

> **Comments:**
> **username_10**: It seems like brainwallet.org is abandoned  

---

### Answer by username_11 on 2021-06-23. Score: 0

An updated version of @username_8's answer above that I figured out from playing with the pycoin API. This solution works with the recent versions of pycoin, which has changed a lot over the years it seems.
from pycoin.symbols.btc import network
k = network.parse.private_key(" ... ")
k.address()


---

### Answer by username_12 on 2015-06-22. Score: 0

its very simple.

just download ofline bitaddress.org page (for security, other wise online will also work, but there could be security risk )and click on wallet details tab.

enter your private key and you will get your corresponding public key.

> **Comments:**
> **username_13**: They want to run a script, not do a manual process.  

---

### Answer by username_14 on 2021-01-03. Score: 0

You can try tool btc-address-dump, installation: pip3 install btc-address-dump.
Dump btc address from hex private key:
$ btc_address_dump c7ac679b56f50bfd54dd924fe45a8dca7a1c2dced254b03dac22afc03adb9127
private key (hex) = c7ac679b56f50bfd54dd924fe45a8dca7a1c2dced254b03dac22afc03adb9127
private key (WIF) = 5KLDyKtrScLYsKMJzVCt8Mf6Nn9DEV7V3fg8njfSZnqe7ZEMqzK
private key (WIF compressed) = L3urFcPsE2yHf5zeQjVSfUB8j8FEzX5cnmhjNsJfqjKgowPP4tmg
public key (uncompressed) = 044cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1087190d91e26af594e3f8ecd3f4d3596c03c45d3b235da916903c930c6593cc4
public key (compressed) = 024cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1
address (p2pkh uncompressed) = 1Q5RqZctfcNkTPad2tuJSREByd2gB8xs63
address (p2pkh compressed) = 12W36tm2jnreFiYdrzfE6cvRaKRbicEpnA
address (p2wpkh) = bc1qzp6lz6zy9p7k68r0a7lzfpkdxvj3yapynzuatt

Dump btc address from WIF private key:
$ btc_address_dump 5KLDyKtrScLYsKMJzVCt8Mf6Nn9DEV7V3fg8njfSZnqe7ZEMqzK
private key (hex) = c7ac679b56f50bfd54dd924fe45a8dca7a1c2dced254b03dac22afc03adb9127
private key (WIF) = 5KLDyKtrScLYsKMJzVCt8Mf6Nn9DEV7V3fg8njfSZnqe7ZEMqzK
private key (WIF compressed) = L3urFcPsE2yHf5zeQjVSfUB8j8FEzX5cnmhjNsJfqjKgowPP4tmg
public key (uncompressed) = 044cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1087190d91e26af594e3f8ecd3f4d3596c03c45d3b235da916903c930c6593cc4
public key (compressed) = 024cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1
address (p2pkh uncompressed) = 1Q5RqZctfcNkTPad2tuJSREByd2gB8xs63
address (p2pkh compressed) = 12W36tm2jnreFiYdrzfE6cvRaKRbicEpnA
address (p2wpkh) = bc1qzp6lz6zy9p7k68r0a7lzfpkdxvj3yapynzuatt

Dump btc address from mnemonic words:
$ btc_address_dump "olympic wine chicken argue unaware bundle tunnel grid spider slot spell need"
mnemonic = olympic wine chicken argue unaware bundle tunnel grid spider slot spell need
private key (hex) = c7ac679b56f50bfd54dd924fe45a8dca7a1c2dced254b03dac22afc03adb9127
private key (WIF) = 5KLDyKtrScLYsKMJzVCt8Mf6Nn9DEV7V3fg8njfSZnqe7ZEMqzK
private key (WIF compressed) = L3urFcPsE2yHf5zeQjVSfUB8j8FEzX5cnmhjNsJfqjKgowPP4tmg
public key (uncompressed) = 044cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1087190d91e26af594e3f8ecd3f4d3596c03c45d3b235da916903c930c6593cc4
public key (compressed) = 024cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1
address (p2pkh uncompressed) = 1Q5RqZctfcNkTPad2tuJSREByd2gB8xs63
address (p2pkh compressed) = 12W36tm2jnreFiYdrzfE6cvRaKRbicEpnA
address (p2wpkh) = bc1qzp6lz6zy9p7k68r0a7lzfpkdxvj3yapynzuatt

Dump btc address from public key:
$ btc_address_dump 024cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1
public key (uncompressed) = 044cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1087190d91e26af594e3f8ecd3f4d3596c03c45d3b235da916903c930c6593cc4
public key (compressed) = 024cd0aaeca3b636078583408e75edd77307b5190ca7a48bb9fbc1f2576c17dff1
address (p2pkh uncompressed) = 1Q5RqZctfcNkTPad2tuJSREByd2gB8xs63
address (p2pkh compressed) = 12W36tm2jnreFiYdrzfE6cvRaKRbicEpnA
address (p2wpkh) = bc1qzp6lz6zy9p7k68r0a7lzfpkdxvj3yapynzuatt


---

