Number base converter
0x2F is 47, and nobody remembers that.
Examples temporarily replace the input and settings. You can restore your previous work.
0 characters
Output
Paste or type above to see the result here.
Your files stay on your device
This tool runs entirely in your browser. What you paste is processed on your device and is never sent to a server, so it is safe to use with tokens, keys and unpublished text.
Example
Example: GCSE Computer Science homework in binary, denary and hex
A Year 10 student checks a homework sheet: denary 182 to binary and hex, binary 01011010 and hex 3C to denary, and FF, the largest 8-bit number. Read the input as: Decimal; one number per line, the binary and hex ones written with 0b and 0x.
- 182 comes back as binary 10110110 and hex B6: 128 + 32 + 16 + 4 + 2 = 182, and 1011 0110 is B then 6.
- 0b01011010 is read as binary whatever the setting: denary 90, hex 5A. The answer drops the leading 0 (1011010); write 01011010 when the question wants 8 bits.
- 0x3C is denary 60, binary 111100, which is 00111100 as a full byte; 0xFF is 255.
- A bare 1101 is read in the base chosen: as Decimal it is one thousand one hundred and one. Choose Binary, or type 0b1101, to get 13.
| Input | Read as | Binary | Denary | Hex |
|---|---|---|---|---|
| 182 | base 10 | 10110110 | 182 | B6 |
| 0b01011010 | base 2 | 1011010 | 90 | 5A |
| 0x3C | base 16 | 111100 | 60 | 3C |
| 0xFF | base 16 | 11111111 | 255 | FF |
| 1101 | base 10 | 10001001101 | 1101 | 44D |
| 0b1101 | base 2 | 1101 | 13 | D |
Every line comes back in binary, octal, denary and hex at once, so each answer on the sheet is checked in one go. Octal is shown too: 182 is 266.
How it works
- Type the numbers, one per line.
- Choose which base to read them in — or write 0x, 0b or 0o and that decides instead.
- Every common base comes back at once, so there is nothing to convert twice.
- Turn on bytes if you are reading a value out of a memory dump or a protocol.
Frequently asked questions
- Do I have to say which base it is in?
- Only for a bare number. 0x2F, 0b1010 and 0o17 say it themselves and are read that way whatever the setting is, because that is how they arrive — copied out of a debugger, a hex editor or a stack trace.
- Will a 64-bit value survive?
- Yes. The arithmetic is done in arbitrary precision, so 0xFFFFFFFFFFFFFFFF comes back as 18446744073709551615 rather than as the rounded-off number a tool built on JavaScript's ordinary numbers would give you. That rounding is silent, which is what makes it worth avoiding.
- What are the odd bases for?
- Base 32 and base 36 turn up in short identifiers and URL shorteners; base 12 and base 7 turn up in puzzles and homework. The converter goes up to 36, which is as far as digits plus the alphabet reach.
- Can it do fractions?
- No — whole numbers only. A binary fraction is a different question with its own traps, and pretending 0.1 converts cleanly would be the biggest of them.
- Why does my binary answer lose its leading zeros?
- Numbers come back without leading zeros, as they are written in maths: 0b01011010 gives 1011010 and 0x3C gives 111100. For an 8-bit answer, pad on the left to eight digits (01011010, 00111100).
- What about negative numbers?
- The minus sign is kept: -5 comes back as -101 in binary and -5 in hex. That is sign and size, not two’s complement. For the 8-bit two’s complement of -5, convert 251 (256 − 5) instead: 11111011, hex FB.
- Is anything sent to a server?
- No. It runs in your browser, so what you paste stays on your computer.
Related tools
∿ ASCII and Unicode table The code for a character, or the character for a code. ∿ Base64 Convert text to Base64 and back, with correct UTF-8 handling and an optional URL-safe alphabet. # Hash Generator Get the MD5, SHA-1 or SHA-2 digest of any text, computed on your device. ◒ Colour converter HEX, RGB, HSL and CMYK — plus the contrast ratio that decides readability.