Skip to content
moxon home

Base Conversion

The /base endpoint converts a number from one numeric base to another, anywhere between base 2 and base 36.

gethttps://api.moxon.dev/v5/base

How it works?

Digits are read as 0-9 then a-z, representing the values 0 to 35, so input is case-insensitive and the result is always lowercase. The conversion uses arbitrary-precision integers: values far beyond Number.MAX_SAFE_INTEGER keep every digit intact. A leading minus sign is preserved, except when the value is zero (-0 returns 0).

Try itget/v5/base

Parameters

  • valuestringrequired

    Number to convert, optionally prefixed with -. Up to 100 characters, valid for the from base

  • fromstringoptional

    Input base, an integer between 2 and 36. Default: 10

  • tostringoptional

    Output base, an integer between 2 and 36. Default: 16

Response Fields

  • valuestring

    The original input value, as provided

  • fromnumber

    Input base used for the conversion

  • tonumber

    Output base used for the conversion

  • resultstring

    The converted value, in lowercase digits

Code Examples

Error Handling

If parameters are missing or invalid, the API will return an error:

  • 400Please provide a value (?value={value})The value parameter is missing
  • 400Value must be 100 characters or fewerThe value exceeds the maximum length
  • 400Base must be a numberfrom or to is not an integer
  • 400Base must be between 2 and 36from or to is outside the supported range
  • 400Invalid value for base {from}A digit of value does not exist in the input base, or value is only a minus sign