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://requiems.xyz/v1/technology/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://requiems.xyz/v1/technology/base?from=10&to=16&value=255" \
  -H "requiems-api-key: YOUR_API_KEY"

# Hex to binary (using 0x prefix)
curl "https://requiems.xyz/v1/technology/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.

Batch Convert Base

Convert up to 50 numbers between bases in a single request. Results are returned in input order. Per-item errors are reported inline.

POST
https://requiems.xyz/v1/technology/base/batch

Parameters

Name Type Required Description
items array<object> Required List of conversion requests (1–50 items).
items[].from integer Required Source base (2, 8, 10, or 16).
items[].to integer Required Target base (2, 8, 10, or 16).
items[].value string Required The number as a string. Accepts optional prefixes: 0x (hex), 0b (binary), 0o (octal).

Try it out

Live Demo
Request

List of conversion requests (1–50 items).

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
results array<object> Per-item results in input order.
results[].from integer The source base used for conversion.
results[].to integer The target base used for conversion.
results[].input string The original value as provided in the request.
results[].result string The converted value in the target base (omitted on error).
results[].error string Error message if this item failed (omitted on success).
total integer Total number of items processed.

Code Examples

curl -X POST https://requiems.xyz/v1/technology/base/batch \
  -H "requiems-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"items": [{"from": 10, "to": 16, "value": "255"}, {"from": 2, "to": 10, "value": "1111"}]}'

Error Responses

validation_failed

The items array is missing, empty, or exceeds 50 items.

bad_request

The request body is missing or malformed.

Frequently Asked Questions