How to get solana token address from mint address using solana/web3.js?

for examples, in the case of https://solscan.io/address/AtRGBFrgzy3iYcRjyRLkQCjQrBpXEnP5PH2xgpxPt6EN?cluster=devnet

How to get 'AtRGBFrgzy3iYcRjyRLkQCjQrBpXEnP5PH2xgpxPt6EN' from '89dre8rZjLNft7HoupGiyxu3MNftR577ZYu8bHe2kK7g'?

1 Answer 1


This is the associated token address for the mint 89dre8rZjLNft7HoupGiyxu3MNftR577ZYu8bHe2kK7g and the owner 72QTssce1DbnmkbytEewssHMd4xGxUY3faEF8RGoBZde. You need to know both pieces of information to derive the associated token address.

Once you know those, you can get it like this:

const { getAssociatedTokenAddress } = require('@solana/spl-token')
const { PublicKey } = require('@solana/web3.js')

async function main() {
  const mint = new PublicKey('89dre8rZjLNft7HoupGiyxu3MNftR577ZYu8bHe2kK7g')
  const owner = new PublicKey('72QTssce1DbnmkbytEewssHMd4xGxUY3faEF8RGoBZde')

  const tokenAddress = await getAssociatedTokenAddress(mint, owner)
  return tokenAddress.toBase58()

Replit example: https://replit.com/@mcintyre94/solana-token-mint#index.js

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.