How to Import and Export Wallets between CLI and Wallet providers?

How do I export my wallet keypair generated from the Solana CLI and import it into a wallet like phantom or solflare?

And how to export that wallet keypair from the wallet provider and import it back to a JSON file for the CLI?

1 Answer 1


Open the the .json file created by the CLI and copy the contents(it should look like [12,54,11,64,etc...]). Then go to the wallet you want to use, select import private key and paste the contents.

Phantom: + Add/Connect Wallet > Import Private Key

Solflare: Settings > Account > Import A New Wallet > More Options > Import Private Key

  • hi thanks! does the reverse work for exporting from the wallet back to .json for CLI or how does that work? Jul 22, 2022 at 1:36
  • you should ask this in a new post
    – trent.sol
    Jul 22, 2022 at 5:50

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.