Tokens/convert

Convert token amounts

$0.01per call after 25 free a day

Converts between normal amounts and raw units with the token's real on-chain decimals.

Run before putting any token amount in a transaction. "5 USDC" is 5,000,000 raw units; wrong decimals send 1,000x too much or too little.

Saves money. 5 USDC is 5,000,000 raw units because USDC has 6 decimals. Get the decimals wrong and you send 1,000 times too much or too little.

Call it

TransportHow
HTTPPOST /api/tools/convert with a JSON body of the inputs below.
MCPtools/call with name convert on /mcp.

Inputs

NameWhat it's looking forWhere to get it
token
string (token address) or "SOL", required
The token, or "SOL" for SOL (9 decimals).From find_token or tokens.
amount
string (decimal), required
The amount, as a string: "5" or "0.25".The user's amount. A string avoids rounding errors.
to
"raw" | "readable", optional
Direction. "raw" turns 5 into 5000000 (for transactions); "readable" turns raw units back. Default "raw"."readable" for amounts read from chain data.
network
"mainnet-beta" | "devnet", optional
Default "mainnet-beta" (real money)."devnet" only for test wallets.

Returned fields

Every field the tool returns, what it is, and exactly how it's worked out.

FieldWhat it isHow it's worked out
token
string
The token converted (SOL's own address for SOL).Your input. "SOL" becomes So11111111111111111111111111111111111111112.
symbol
string | null
Ticker from Jupiter, for display only.Jupiter token search by address.
decimals
number
Decimal places the token uses.Read from the token on chain (SOL is always 9).
decimals_from
string
Where the decimals came from, so you can trust them."on-chain token" or "SOL (fixed)".
raw_amount
string (integer)
The amount in raw units, exactly as it goes into a transfer.amount x 10^decimals with exact integer math. Refuses more decimal places than the token has.
amount
string (decimal)
The normal, readable amount.raw_amount / 10^decimals with exact integer math.
summary
string
One sentence stating the conversion.Built from the values above.