The digits 10 can describe four different quantities. In binary they mean two, in octal they mean eight, in decimal they mean ten, and in hexadecimal they mean sixteen. The digits only tell you the value once you know the base. This matters when a device manual, a software log, and a spreadsheet all use different conventions for writing the same integer.
TinyToolbox Number Base Converter converts a whole number from any of those four bases and displays it in all four. Specify the input base explicitly. Then use the result that matches the destination, adding any prefix or fixed width required by that destination as a separate step.
Identify the input base and valid digits
A positional number system uses place values based on powers of its base. In decimal, the digits in 205 represent two hundreds, zero tens, and five ones. Binary works the same way with powers of two. Hexadecimal uses powers of sixteen and needs six more digit symbols than decimal, so it uses the letters A through F for values ten through fifteen.
| Base | Name | Digits |
|---|---|---|
| 2 | Binary | 0 and 1 |
| 8 | Octal | 0 through 7 |
| 10 | Decimal | 0 through 9 |
| 16 | Hexadecimal | 0 through 9 and A through F |
A prefix may tell you the base in a programming language or manual. Common examples include 0b for binary, 0o for octal, and 0x for hexadecimal. In this converter, use the Input base selector and enter the digits without those prefixes. For 0xFF, select Hexadecimal and enter FF. The tool accepts uppercase or lowercase hex digits.
If the source does not state the base, find it from the field documentation or the surrounding text. Some digits rule out certain bases. 8 cannot appear in an octal integer, for instance. But 1010 is valid in all four. A successful conversion cannot tell you which interpretation the author intended.
Convert an integer in TinyToolbox
- Open Number Base Converter.
- Type or paste the digits under Input text.
- Select Decimal, Binary, Octal, or Hexadecimal under Input base.
- Select Run tool.
- Read the four labeled values under Result. Select Copy result if you need to keep the complete comparison.
Try 255 with Decimal selected. The tool returns:
Binary: 11111111
Octal: 377
Decimal: 255
Hexadecimal: ff
You can check the hex result by converting ff back from hexadecimal. Each f represents fifteen. The leading one is in the sixteens place, so the expression is 15 × 16 + 15, or 255. For octal, 377 means 3 × 64 + 7 × 8 + 7, also 255. The different strings represent the same quantity.
The form runs in your browser and accepts up to 2,000 digits, plus an optional leading sign. Enter whole numbers without grouping separators, embedded spaces, fractions, or scientific notation. For example, enter 1000 instead of 1,000 or 1e3 in decimal. If you paste a value from a manual, remove any formatting the source adds around the digits.
Use binary groupings to check a hex result
Each hexadecimal digit corresponds to four binary digits, called bits. This works because sixteen equals two raised to the fourth power. To check the conversion for 3A, write the four-bit binary form of 3 as 0011 and the four-bit form of A as 1010. Together they give 00111010. The converter will display 111010, because leading zeros do not change the integer’s value.
Use this check when the source describes a register or bit field. For example, 0x80 is hexadecimal for 128 and corresponds to 10000000 in an eight-bit unsigned field. Whether that bit pattern has another meaning depends on the system. The converter gives the mathematical value in each base. Refer to the record or protocol for the roles of individual bits.
Octal uses groups of three binary digits because eight is two raised to the third power. Decimal 63 gives octal 77 and binary 111111. Two groups of 111 each represent seven. If you need to add leading zeros for a grouping exercise, add them on the left. Adding zeros on the right changes the value.
Distinguish a negative integer from a signed bit pattern
To convert a negative integer, put a minus sign before its magnitude. For example, select Decimal and enter -10. The result shows -1010 in binary, -12 in octal, and -a in hexadecimal. These are signed textual forms of the same integer.
A program can also use a fixed number of bits to encode a signed value. For example, 11110110 represents 246 when read as an unsigned eight-bit value and -10 when decoded as eight-bit two’s complement. The converter interprets an input without a minus sign as a nonnegative integer. It cannot infer the signed encoding just from the digits.
Check the representation if you work with a hardware register or binary file. Look for the width and whether the value is signed before deciding what it means. If the source supplies several bytes as hex, the byte order can determine how to assemble the integer. This form converts the digits you supply in their written order. It does not reorder bytes or apply a specific signed format.
Put back any required leading zeros or prefixes
The converter displays the integer using the usual compact notation. For example, 000f in hexadecimal becomes f in hexadecimal and 1111 in binary. If the next field requires exactly four hex digits, use 000f. When a code has a fixed width, its representation can be important even though the additional zeros do not change the number.
Similarly, the output labels identify the base and the values do not include language prefixes. If source code expects a prefixed hexadecimal literal, add the prefix in the form that language uses. If the recipient requests uppercase hex, adjust the letters after conversion. Keep an example from the receiving system so you can compare the exact spelling before pasting a large value.
Some values are identifiers and should remain strings. Converting 0017 to another base is meaningful only if the ID is defined as an integer in the first place. If 0017 and 17 are distinct labels in the source system, keep them as written. For text encodings, use a workflow such as UTF-8 Byte Inspector to check the bytes of the text. A string of characters and the integer represented by those characters are separate inputs.
Verify large numbers and diagnose rejected input
The tool uses JavaScript BigInt for conversion, so it can process integers beyond the range where ordinary JavaScript numbers keep every digit. For example, the decimal value 9007199254740993 converts to hexadecimal 20000000000001. Paste the original digits without passing them through a spreadsheet or a number formatter that might round them first. The converter can preserve the digits it receives, but cannot recover digits lost upstream.
If the tool rejects the input, confirm the selected base and check for prefixes, commas, underscores, or unsupported digits. A letter such as G is outside hexadecimal. A digit such as 2 is outside binary. If you copied a signed value, check that it starts with a plain minus or plus sign. Some documents use a different dash character that looks similar but is not recognized as a sign.
For a final check, take the output in the destination base and convert it back using the matching input setting. Verify that the decimal value agrees with your original interpretation. Then confirm any width, prefix, letter case, byte order, or signed convention in the receiving workflow. A reliable handoff preserves both the integer’s value and the representation the next system is expecting.
Read the same field in four representations
Suppose a device’s example documentation describes an unsigned counter value as 0x02D4, while a diagnostic display shows 724. To check whether they agree, open the Number Base Converter, select Hexadecimal, and enter 02D4 without the prefix. The decimal result is 724. Reopen the tool in decimal mode and convert 724 back to hexadecimal. The numeric value comes back as 2d4, apart from the formatting differences between the display and the documentation.
Check the decimal number by expanding the hex digits. The 2 stands in the 256s place, D means thirteen in the 16s place, and 4 stands in the ones place. The result is 2 × 256 + 13 × 16 + 4 = 724. The leading zero in the documentation holds a position in a four-digit field. It contributes zero to the sum.
The binary value is 1011010100. To check it from hex, replace 2, D, and 4 with their four-bit groups, 0010 1101 0100, and remove the two leading zeros if you want the minimal unsigned representation. To read octal, start from the binary digits and group them into threes from the right. Pad the left group with zeros as needed to get 001 011 010 100, which reads 1324 in octal. Convert 1324 using octal mode to confirm it gives the same decimal value.
If the receiving specification calls for a 16-bit field, retain four hex digits or sixteen binary digits when writing out the result. The padded binary groups are 0000 0010 1101 0100. The leading zeroes make the field width visible. The converter calculates the integer independently of that field width. Check which representation a destination expects before deciding whether to copy the minimal output or supply padding.
Keep byte order separate from the number’s spelling
Suppose the same specification shows the two bytes of that 16-bit value separately. In a big-endian byte order, the most significant byte comes first, so the two bytes are 02 D4. In little-endian byte order, the bytes are D4 02. Both byte sequences can represent 724 in their respective conventions. Determine which convention the data format uses before turning a byte sequence into the ordinary hex spelling you will paste into the converter.
For example, entering D402 as a single hexadecimal integer computes 54,274. If you copied those digits from a little-endian representation of 724, the conversion used the digits as written while the data source expected them to be interpreted as ordered bytes. Return to the field definition and arrange the bytes according to that signedness and byte order before treating it as an integer. Reverse complete bytes when the format calls for it. Reversing individual hex characters changes the contents of each byte.
Finally, record the base, width, sign convention, and byte order beside any saved test case. For this example, “unsigned 16-bit value 724, little-endian bytes D4 02” states both the number and how it is stored. That context helps another reader confirm the same result without having to guess whether 02D4, 724, and D4 02 are three values or three ways of representing one.