Developer Tools
Number Base Converter (Binary, Octal, Decimal, Hex)
Convert numbers between binary, octal, decimal, hex and any base from 2 to 36. Handles huge integers, negatives, fractions and 8- to 128-bit two's complement.
How to use Number Base Converter (Binary, Octal, Decimal, Hex)
Type a number, or several on separate lines, and choose the input base or let 0x, 0b and 0o prefixes decide. Results update as you type; pick a two's complement width to see how a value is stored in 8 to 128 bits.
- Enter numbersType 255, 0xFF or 0b1010, one per line. Underscores, spaces and decimal thousands commas are ignored.
- Set the basesLeave Input base on Detect or pick 2–36; use Highlight to emphasise a result or add another base such as base 36.
- Check two's complementChoose an 8-, 16-, 32-, 64- or 128-bit width to see the stored bits and the signed and unsigned readings.
Worked examples
255 converts to 11111111 in binary, 377 in octal and FF in hex, with a bit length of 8 bits. Every calculation uses BigInt, so very long integers stay exact: 12345678901234567890123456789 is 27E41B3246BEC9B16E398115 in hex. With several lines of input you get a table with one row per number, so 0b1010 shows as 10 in decimal and A in hex. Tick Group digits to split binary and hex into groups of four and add thousands separators to decimals, so 1000000 reads 1,000,000.
Two's complement and fractions
Choose a width and negative numbers show their two's complement: -42 in 8 bits is 1101 0110, or D6 in hex, which reads as 214 when unsigned. It works the other way too: 0xFF at 8 bits is -1 when read as signed. Values that do not fit the chosen width are flagged along with the valid range. Fractions are converted to at most 40 digits after the point; 0.1 has no exact binary form, so its binary result starts 0.000110011 and ends with … to show that it never terminates.
Accuracy and data handling
Validate the result with your project's own tests and runtime rules before using it in production. The calculation runs in your current browser; the tool code does not send the input to a processing API.
FAQ
How do I convert a list of numbers at once?
Put each number on its own line, up to 500 lines. The result becomes a table listing the binary, octal, decimal and hex value of every input.
Can I get lower-case hex?
Yes. Untick Upper-case letters (A–F) and hex digits, along with the letters used in higher bases, are shown in lower case.
Why is my number not valid?
It contains a digit that does not exist in the chosen base, such as 2 in binary or a letter in decimal. Check Input base, or use a 0x, 0b or 0o prefix with Detect.
How large a number can it convert?
Each number can be up to 4,000 characters long. Because the maths uses BigInt, integers of that size convert exactly, without rounding.
More Developer Tools
Related toolsTurn text into ASCII codes, or decode decimal, hex and binary codes to text
Convert text to Unicode escapes for JS, Python, HTML or CSS, and decode them
Bulk-check email address syntax with reasons, typo hints and a clean list
Break a URL into scheme, host, port, path, parameters and fragment
Parse URL parameters into JSON, or build a query string from JSON
Escape text for use inside a JSON string, or unescape it back to plain text