Skip to content
PrimeForgeTools
Theme: system

Developmentversion v1.0.0

Number Base Converter

One integer, in any base from 2 to 36, answered as decimal, hex, binary, octal, both two’s-complement readings, the bytes it occupies and its bit length. Choose a width and it stops being mathematics and becomes a machine word: 0xFFFFFFFF is 4294967295 and also −1, and which one you meant is a type, not a guess. The arithmetic is BigInt from end to end, so a 4096-bit key converts exactly where parseInt is off by 1,385 on the most common 64-bit value there is.

Examples
Read as

auto reads a 0x, 0b or 0o prefix and nothing else. ff is not hex until you say so.

Width
Bytes

A byte order needs bytes, and bytes need a width. Choose one above.

Read this once

-1 in hex is -0x1 and it is also 0xFFFFFFFF. Both are correct; they answer different questions, and the difference is a type you have to state. Without a width this is arbitrary-precision sign-magnitude arithmetic; with one it is a fixed-size two’s-complement field.

A value that does not fit a chosen width is refused, never wrapped and never clamped. 4294967296 at 32 bits wrapping to 0 would answer “yes, it fits” to the one person most likely to ask.

Converting text to hex bytes rather than a number? That is /encode: 255 is ff here — one value — and 32 35 35 there — three characters.

Privacy

This page converts in this browser tab. Nothing you type is sent to the server, stored, or written to the URL. That matters more than “a number is not a secret” suggests: a 2048-bit RSA modulus is 617 decimal digits, and converting one between the decimal a library printed and the hex a config file wants is the single most common reason to open a big-integer converter.

No local storage, no analytics, no history entry. The honest asymmetry: the browser is local, the curl path is not.

From the command line

The same URL answers a POST with an eight-line record — one value per line, always eight lines, so sed -n 5p is the signed reading on every input. ?out= selects one field or any base from 2 to 36, and ?width= both fixes the field and decides the exit status.

printf '%s' '0xdeadbeef' | curl -fsS --data-binary @- 'https://tools.primeforge.app/number'
printf '%s' '0xdeadbeef' | curl -fsS --data-binary @- 'https://tools.primeforge.app/number?out=hex'
if printf '%s' '0xdeadbeef' | curl -fsS --data-binary @- 'https://tools.primeforge.app/number?width=32' >/dev/null; then echo 'fits in 32 bits'; fi

⚠ Everything on this page runs in your browser. If that number is key material, use the box above and not the command below — and note printf '%s', because printf reads a leading - as a flag.

One number per request, on one line. A list is one word away: xargs -n1 -I{} sh -c "printf '%s' {} | curl …" — a record whose line count depended on the number of inputs would stop being a record.