Number Base Conversion

Convert integers between binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16).

Get API Key

Overview

Use Cases

  • Developer tools and calculators
  • Converting memory addresses or CPU flags between hex and binary
  • Teaching or learning number systems
  • Debugging low-level protocol data

Features

Supports binary, octal, decimal, and hexadecimal
Accepts optional base prefixes (0x, 0b, 0o)
Supports negative integers
Fast, in-memory only β€” no database required

API Endpoints

Convert Base

Convert an integer from one number base to another.

GET
https://api.requiems.xyz/v1/convert/base

Parameters

Name Type Required Description
from integer Required Source base (2, 8, 10, or 16)
to integer Required Target base (2, 8, 10, or 16)
value string Required The number as a string. Accepts optional prefixes: 0x (hex), 0b (binary), 0o (octal).

Try it out

Live Demo
Request

Source base (2, 8, 10, or 16)

Target base (2, 8, 10, or 16)

The number as a string. Accepts optional prefixes: 0x (hex), 0b (binary), 0o (octal).

Response Fields

Field Type Description
input string The original value as provided in the request
from integer The source base
to integer The target base
result string The converted value in the target base

Code Examples

# Decimal to hex
curl "https://api.requiems.xyz/v1/convert/base?from=10&to=16&value=255" \
  -H "requiems-api-key: YOUR_API_KEY"

# Hex to binary (using 0x prefix)
curl "https://api.requiems.xyz/v1/convert/base?from=16&to=2&value=0xff" \
  -H "requiems-api-key: YOUR_API_KEY"

Error Responses

bad_request

A required parameter is missing, the base is not one of 2/8/10/16, or value is not valid for the given base.

Frequently Asked Questions