user662: I have a private key and I want to add it to the keys in the Bitcoin client.  Is there an easy way to do this?

user659: An answer to How can I export the private key for an address from the satoshi client? gives the steps required to export a private key. The steps to import a private key are the same except that you need to change "dumpprivkey 1aaabbb..." to "importprivkey 5aaabbb...".
If you use bitaddress.org's "Bulk Wallet" feature you can generate a list of private keys, like this:
1,"1AWUTMBC3XuTnPugwznNoju37ptACYRJyn","5K4dStGTDUR4r9yCwe7DqLunr5o7fjs2rH1Qb7KQg76d6KASGqv"
2,"1QKvh1wy8Vgri7BCGnY3XiXsdoX8SpzYTK","5JT6RJLjkKp5UDkkBsTNjNFgoo8o3bB3qK1qvsxKawCjh8X4pQQ"
3,"171er29jxgoUw5GNZFRF5w7FCUeXvPHbyK","5KBmhDfAEPDTd9asLCYcWaJNkc9KNvBmFoZzPTWfCdq3CaLePAB"

To import all the private keys into your wallet:

copy/paste the list into a temporary file, /tmp/bitaddress.txt making sure there's a newline on the end of the last line
tr -d '"' < /tmp/bitaddress.txt | tr , ' ' | while read number address privkey; do echo importing $address; bitcoind importprivkey $privkey; done

Note: if you're running Windows you'll need to modify the command in step 2 to whatever the equivalent Windows shell command would be.
Note 2: the importprivkey command is very slow since it rescans the whole transaction history after each private key import.  It's possible to speed it up considerably by commenting out two lines in the bitcoind source code.
Note 3: importprivkey now has an optional rescan option which you can set to false. This will make importing much faster, and you don't have to edit the source code.

user108: Importing could be done with Pywallet or hopefully soon-to-be-official wallet export/import bitcoin patch, but make sure to backup your wallet first.

662: <p>I have a private key and I want to add it to the keys in the Bitcoin client.  Is there an easy way to do this?</p>
 659: <p>An answer to <a href="https://bitcoin.stackexchange.com/a/4205/659">How can I export the private key for an address from the satoshi client?</a> gives the steps required to export a private key. The steps to import a private key are the same except that you need to change "dumpprivkey 1aaabbb..." to "importprivkey 5aaabbb...".</p>

<p>If you use bitaddress.org's "Bulk Wallet" feature you can generate a list of private keys, like this:</p>

<pre><code>1,"1AWUTMBC3XuTnPugwznNoju37ptACYRJyn","5K4dStGTDUR4r9yCwe7DqLunr5o7fjs2rH1Qb7KQg76d6KASGqv"
2,"1QKvh1wy8Vgri7BCGnY3XiXsdoX8SpzYTK","5JT6RJLjkKp5UDkkBsTNjNFgoo8o3bB3qK1qvsxKawCjh8X4pQQ"
3,"171er29jxgoUw5GNZFRF5w7FCUeXvPHbyK","5KBmhDfAEPDTd9asLCYcWaJNkc9KNvBmFoZzPTWfCdq3CaLePAB"
</code></pre>

<p>To import all the private keys into your wallet:</p>

<ol>
<li>copy/paste the list into a temporary file, <code>/tmp/bitaddress.txt</code> making sure there's a newline on the end of the last line</li>
<li><code>tr -d '"' &lt; /tmp/bitaddress.txt | tr , ' ' | while read number address privkey; do echo importing $address; bitcoind importprivkey $privkey; done</code></li>
</ol>

<p>Note: if you're running Windows you'll need to modify the command in step 2 to whatever the equivalent Windows shell command would be.</p>

<p>Note 2: <strike>the <code>importprivkey</code> command is very slow since it rescans the whole transaction history after each private key import.  It's possible to speed it up considerably by <a href="https://bitcointalk.org/index.php?topic=43496.msg1065765#msg1065765" rel="nofollow noreferrer">commenting out two lines in the bitcoind source code</a>.</strike></p>

<p>Note 3: importprivkey now has an optional rescan option which you can set to false. This will make importing much faster, and you don't have to edit the source code.</p>
 108: <p>Importing could be done with <a href="https://bitcointalk.org/index.php?topic=34028.0">Pywallet</a> or hopefully soon-to-be-official <a href="https://bitcointalk.org/index.php?topic=8091.0">wallet export/import bitcoin patch</a>, but make sure to backup your wallet first.</p>
