Binary, decimal and hexadecimal converter
Enter an integer to compare binary (2), octal (8), decimal (10) and hexadecimal (16). Use 0b, 0o or 0x prefixes, large integers, bit toggles and worked conversions.
base · bits · steps
Base converter, bit board and worked steps
Compare four base representations, then explore fixed-width bits and how the conversion works.
Enter a value and its source base, or use the bit board and worked steps.
Waiting for a valuePrefixes 0b, 0o and 0x select the base automatically. Spaces and underscores used to group digits are removed before conversion.
If the value sent to the bit board exceeds the unsigned 32-bit maximum 4294967295, the board shows that maximum instead. The original conversion result stays unchanged.
Reset converter restores only the source value and base in Convert. The bit board and worked steps stay as they are. Use All off to clear the bit board.
How to convert number bases
This number base converter compares binary (2), octal (8), decimal (10) and hexadecimal (16) in real time. Decimal 255 becomes binary 11111111, octal 377 and hex FF. Copy one result or all results as raw strings suitable for code. Prefixes such as 0b1010, 0o17 and 0xFF are detected automatically. Underscores in 1010_1101 and spaces between digit groups are removed before calculation.
Integer calculations use JavaScript BigInt, so values beyond 2⁵³ retain their exact digits. Choose a source base from 2 to 36. The 8, 16 and 32-bit board shows each bit alongside unsigned and two's complement interpretations. Worked steps show positional expansion and repeated division in tables for computing and computer architecture exercises. Calculations run in the current browser without sending input values to a Toolvil server.
When this tool is needed
- Cross-check color, memory or log values such as 0xFF in binary (2) and decimal (10)
- Explore permission flags and bitmasks on an 8, 16 or 32-bit board with two's complement interpretation
- Check worked conversions for computing and computer architecture exercises
Before converting
- Without a prefix, use only digits valid in the source base. A 2 in binary (2) is invalid.
- Prefixes 0b, 0o and 0x take priority over the selected source base.
- Convert accepts integers from 0 upward. The bit board accepts values from its signed minimum to its unsigned maximum.
How to use
- Choose BIN, OCT, DEC or HEX, or use a 0b, 0o or 0x prefix.
- Enter a value to see base 2, 8, 10 and 16 results, the bit count and suggested unsigned type.
- Copy a result card or choose Copy all results to get raw strings.
- In Bit board, choose a width and toggle bits, invert or shift to explore two's complement (2).
- In Steps, choose the source and target bases and check the positional expansion and division tables.
Common decimal (10), binary (2), octal (8) and hexadecimal (16) values
| decimal (10) | binary (2) | octal (8) | hexadecimal (16) |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 10 | 1010 | 12 | A |
| 16 | 1 0000 | 20 | 10 |
| 32 | 10 0000 | 40 | 20 |
| 64 | 100 0000 | 100 | 40 |
| 128 | 1000 0000 | 200 | 80 |
| 255 | 1111 1111 | 377 | FF |
| 1024 | 100 0000 0000 | 2000 | 400 |
Three modes: convert, bit board and steps
Use the three tabs according to your task. Convert gives four base representations quickly. Bit board lets you manipulate individual bits. Steps explains the conversion in tables that you can follow and check.
Bit toggles and two's complement (2) negatives
Choose 8, 16 or 32 bits. Each click changes a bit between 0 and 1 and updates binary (2), octal (8), unsigned decimal (10) and hexadecimal (16). If the highest bit is 1, the same pattern is also interpreted as a fixed-width two's complement (2) negative value. For example, 8-bit 11111111 represents unsigned 255 or signed -1. Invert and logical left/right shifts show how flags and masks change.
Positional expansion and repeated division
To convert to decimal (10), multiply each digit by its positional weight, a power of the source base, and add the products. To convert from decimal (10), divide repeatedly by the target base and read the remainders from bottom to top. Steps displays those operations in tables.
Large integers with BigInt and bases 2~36
BigInt preserves exact integers beyond the safe Number integer limit of 2⁵³-1. Source bases from 2 to 36 cover more than the four common representations. Practical input length and worked-table size depend on browser memory and the execution environment.
Computing exercises and development tasks
Use worked conversions to check computing and computer architecture exercises, and build masks on the bit board to explore how they work. In development, these representations can help with color values, permission flags and address components. Check the actual protocol or data format before applying a result.
This tool supports integer base conversion and fixed-width two's complement (2) interpretation. It does not convert IEEE 754 floating-point formats, fractional parts, endianness or byte order. Use the relevant protocol documentation and independent checks for system-level work.
FAQ
Can I enter prefixes such as 0xFF or 0b1010?
Yes. Prefix 0b selects binary (2), 0o selects octal (8) and 0x selects hexadecimal (16). A prefix takes priority over the selected base. Spaces and underscores used for grouping, as in 1010_1101 or 1010 1101, are removed before exact integer calculation.
Can I check negative values and two's complement (2) bits?
Convert does not accept negatives without a bit width. Instead, choose 8, 16 or 32 bits in Bit board and enter a negative integer such as -1. It shows the fixed-width two's complement (2) pattern and both unsigned and signed interpretations.
Can I see the conversion steps?
Yes. In Steps, choose source and target bases. Conversion to decimal (10) shows positional expansion; conversion from decimal (10) shows repeated division in tables. Prefixes 0x and 0b are detected too. Use the tables to check computing and computer architecture exercises.
Can I convert large integers and bases 2~36?
Yes. JavaScript BigInt preserves exact integers beyond the safe Number integer limit of 2⁵³-1. Set a source base from 2 to 36, including compact identifiers that use letters A to Z.
How do copying and input privacy work?
Use a card copy button or Copy all results. The tool reports whether copying succeeded. Base conversions, bit operations and worked calculations run in the current browser without uploading or saving input values on a Toolvil server.