How to convert integers between binary, octal, decimal and hex
Choose the source base, enter unprefixed digits, preserve a large integer, and understand negative or padded results.
Open the toolChoose a number conversion rather than text encoding
This tool represents the same whole number in a different base. It does not turn a phrase into binary text, decode Base64 or convert a floating-point bit pattern. The available bases are binary 2, octal 8, decimal 10 and hexadecimal 16. Decide which base your input already uses before entering it. The digits 10 mean ten in decimal but two in binary. The converter cannot infer that choice from a short digit string, so check the From selector carefully.
Run a small example and check the place values
Open the Number Base Converter. Choose From 10 and To 16, enter 42 in Input, then select Apply. Result is 2A. Converting that value from 16 to 2 gives 101010; from 16 to 8 it gives 52. For the hexadecimal check, A represents ten, so 2A means 2 × 16 + 10 = 42. Copy or download the result if needed. Changing a field clears the old output; apply again after changing either base or the input.
Enter valid digits without programming prefixes
Use only digits allowed by the source base: 0–1 for binary, 0–7 for octal, 0–9 for decimal, and 0–9 plus A–F for hex. Lowercase hexadecimal letters are accepted; output letters are uppercase. Enter FF with From 16, not 0xFF. Prefixes such as 0b and 0o, a leading plus sign, decimal fractions, scientific notation in decimal mode and grouping separators are not supported. Surrounding whitespace is trimmed, but spaces between digits are not a way to group a long number.
Preserve a large integer exactly
Try the built-in example value 9007199254740993 with From 10 and To 16. The result is 20000000000001. Converting that hex value back to decimal returns the original digits. The engine uses integer arithmetic rather than first rounding the input to an ordinary floating-point number. Preserve long values as text when moving them through another application; a receiving spreadsheet or program can still round them independently. Exact conversion here does not change the receiving system’s numeric rules or storage format.
Interpret signs, zero padding and limits
A leading minus sign represents a negative integer: -42 in decimal becomes -101010 in binary when entered with the ordinary hyphen-minus. This is a signed textual result, not a fixed-width two’s-complement encoding. Leading zeros are not preserved as a width setting; 00042 converts like 42. The input field is limited to 4,096 characters and there is no bit-width, endian, fractional or custom-base selector. Processing stays in your browser. Keep the selected bases with any saved result so its meaning is clear later.
Sources
Updated:
Try it in the tool →