Number Base Converter: Binary, Octal, Decimal, Hex
Convert numbers between binary, octal, decimal, hex and bases up to 36.
Use via API
Convert a whole number of any size between binary, octal, decimal, hexadecimal and any base from 2 to 36. Send JSON, get JSON back.
POST https://pithlab.com/api/v1/tools/number-base-converter
curl https://pithlab.com/api/v1/tools/number-base-converter \
-H "Authorization: Bearer $PITHLAB_KEY" \
-H "Content-Type: application/json" \
-d '{"input":"255","from":10,"to":36}'About the Number Base Converter
Convert whole numbers between binary, octal, decimal, hex and any base from 2 to 36. Exact for huge and negative numbers, with prefixes and digit grouping.
How to use the Number Base Converter
- Type or paste a whole number and pick the base it is written in.
- Prefixes such as 0x, 0b and 0o are accepted. With decimal selected, a prefix switches to that base automatically.
- Read the binary, octal, decimal and hexadecimal results, and pick any other base from 2 to 36 for a custom result.
- Tick Group digits for easier reading, or Uppercase letters for hex style A to F, then copy any result.
Examples
Input
255
Output
Binary (base 2): 11111111 Octal (base 8): 377 Decimal (base 10): 255 Hexadecimal (base 16): ff
Input
0xFF
Output
Binary (base 2): 11111111 Octal (base 8): 377 Decimal (base 10): 255 Hexadecimal (base 16): ff
Input
-42
Output
Binary (base 2): -101010 Octal (base 8): -52 Decimal (base 10): -42 Hexadecimal (base 16): -2a
Frequently asked questions
How big a number can I convert?
There is no fixed limit. The converter uses JavaScript BigInt arithmetic, so numbers with hundreds of digits convert exactly without rounding.
How are negative numbers shown?
With a minus sign in every base, for example -2a in hex. This is a signed magnitude, not two's complement, so the result does not depend on a word size.
Which digits are used above base 10?
The letters a to z stand for 10 to 35, so base 16 uses 0 to 9 and a to f, and base 36 uses every digit and letter. Input letters can be upper or lower case.
Can I convert fractions?
No. Only whole numbers are supported, and a decimal point is reported as an invalid digit.
Can I paste numbers with spaces or underscores?
Yes. Spaces and underscores are ignored as digit separators, as are commas in decimal input, so 1_000_000 and 1,000,000 both work.