# Number Base Converter - BigInt-Exact, Bases 2-36 (`eliai/number-base-converter`) Actor

Radix conversion that never corrupts big values: BigInt throughout, so 2^64-1 converts exactly (floats fail past 2^53). Bases 2-36, 0x/0o/0b prefixes just work, negatives get 8/16/32/64-bit two's-complement views, bit/byte lengths included. $0.0004 per conversion; invalid digits never charged.

- **URL**: https://apify.com/eliai/number-base-converter.md
- **Developed by:** [Broke to Built](https://apify.com/eliai) (community)
- **Categories:** Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.32 / 1,000 converted numbers

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Number Base Converter — BigInt-Exact, Bases 2-36, Two's Complement

Convert numbers between any bases 2-36 with **arbitrary precision** — values beyond 2^53 convert exactly (BigInt throughout, never a float in sight). Standard prefixes (`0x`, `0o`, `0b`) just work, negatives get two's-complement views at 8/16/32/64 bits, and every record includes all common bases at once. Up to 50 conversions per run, online, by API, or as an agent tool via Apify MCP.

The precision point is the product: most online converters silently corrupt anything past 15-16 digits because they run on floats. `18446744073709551615` (2^64-1) converts here to exactly `ffffffffffffffff` — asserted by our release test.

### What you get

- **decimal / binary / octal / hex** — always, plus **toBaseValue** for any explicit target base 2-36
- **bitLength / byteLength** — how wide the value really is
- **twosComplement** — for negatives, the 8/16/32/64-bit views (binary, hex, unsigned) where the value fits
- Prefix smarts: `0xff` converts as hex without declaring `fromBase` (the prefix wins whenever its letter isn't a valid digit in the declared base — so base-34+ values containing literal `x` still parse correctly)
- Underscore separators accepted (`1_000_000`)
- **Fail-soft**: invalid digits for the declared base never fail the run — `{ok: false, error}` naming the bad digit, **never charged**.

### Input

```json
{ "value": "0xDEADBEEF" }
```

Bulk with explicit bases: `{ "items": [{ "value": "18446744073709551615", "fromBase": 10, "toBase": 16 }, { "value": "-42" }] }`

### Output (real run)

```json
{
  "input": "0xDEADBEEF",
  "ok": true,
  "fromBase": 16,
  "decimal": "3735928559",
  "binary": "11011110101011011011111011101111",
  "octal": "33653337357",
  "hex": "deadbeef",
  "bitLength": 32,
  "byteLength": 4,
  "isNegative": false,
  "bases": { "2": "...", "8": "...", "10": "3735928559", "16": "deadbeef" }
}
```

`-42` additionally returns `twosComplement: { "8": { "binary": "11010110", "hex": "0xd6", "unsigned": "214" }, ... }`.

### Pricing

**$0.0004 per number converted.** No start fee. Invalid inputs are never charged.

No direct paid base-converter incumbent was found on the store (2026-08-07 search — results are file converters). Pricing is the cost-plus floor of our ladder, stated plainly.

### Honest limits

- Integers only — fractional radix conversion is out of scope (a different, rarely-needed tool).
- Two's-complement views appear only at widths where the value fits; a number needing 70 bits shows no 64-bit view rather than a truncated lie.
- Digits are 0-9 then a-z (case-insensitive), standard for bases up to 36.

### FAQ

**Why does BigInt matter for a converter?**
`Number("18446744073709551615")` is already wrong before conversion begins (floats round past 2^53). Hashes, snowflake ids, and 64-bit registers all live past that line — this tool never touches floats.

**How are negative numbers converted?**
The sign is preserved in the standard representations (`-101010` in binary), and `twosComplement` gives you what the bits look like in fixed-width registers — the thing you actually want when debugging.

**Does 0x work without fromBase?**
Yes — and the edge case is handled honestly: in bases 34-36 where `x` is a real digit, your declared base wins over the prefix.

**Can I convert to base 36?**
Any target 2-36 via `toBase`; the four common bases are always included regardless.

**Why did some rows come back `ok: false`?**
A digit wasn't valid for the declared base (e.g. `XYZ` in base 10) — the error names the exact digit. Never charged.

### Use from code or AI agents

```bash
curl -s "https://api.apify.com/v2/acts/EliAI~number-base-converter/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -X POST -H 'Content-Type: application/json' \
  -d '{"items": [{"value": "ff", "fromBase": 16}, {"value": "1010", "fromBase": 2, "toBase": 36}]}'
```

Agents: connect [Apify MCP](https://mcp.apify.com) and call the `EliAI/number-base-converter` tool.

- **Capability:** BigInt-exact radix conversion (2-36) with prefixes, two's complement, bit widths
- **Required input:** `value` (or `items` array); optional `fromBase`/`toBase`
- **Returns:** one record per value with all common bases + optional target base
- **Bounded:** 50 conversions per run; failures isolate per value
- **Side effects:** none

# Actor input Schema

## `value` (type: `string`):

The number to convert, as a string (supports very large numbers and optional 0x / 0o / 0b prefixes). Use a leading '-' for negatives.

## `fromBase` (type: `integer`):

The base the input value is written in (2-36). Default 10.

## `toBase` (type: `integer`):

Optional explicit target base (2-36). If omitted, all common bases (2/8/10/16) are still returned.

## `items` (type: `array`):

Optional list of objects to convert in one run, e.g. \[{"value":"ff","fromBase":16},{"value":"-42"}]. Each object accepts value, fromBase, toBase.

## Actor input object example

```json
{
  "value": "deadbeef",
  "fromBase": 10,
  "toBase": 16,
  "items": []
}
```

# Actor output Schema

## `results` (type: `string`):

Every item this run produced, as JSON.

## `resultsCsv` (type: `string`):

The same items as a spreadsheet-ready CSV.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "value": "255",
    "toBase": 16
};

// Run the Actor and wait for it to finish
const run = await client.actor("eliai/number-base-converter").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "value": "255",
    "toBase": 16,
}

# Run the Actor and wait for it to finish
run = client.actor("eliai/number-base-converter").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "value": "255",
  "toBase": 16
}' |
apify call eliai/number-base-converter --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,eliai/number-base-converter"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/MDqitvsk0aghgE9l3/builds/y4mvVnCvbemz2AzNl/openapi.json
