Converters
Base Converter
Convert integers between binary, octal, decimal, and hexadecimal.
Free to use — no sign-up or login.
The page parses an integer in the source base and rewrites it in the target base. Decimal 42 is binary 101010, octal 52, and hexadecimal 2A.
Bit patterns with a sign bit are on the two’s complement calculator. This page treats the text as a plain positive integer.
Digits allowed in each base
Binary allows 0 and 1. Octal allows 0 through 7. Decimal allows 0 through 9. Hexadecimal also allows A through F. A letter in binary, octal, or decimal is rejected.
The default value
The form starts at decimal 42 toward binary. Swap the bases to read 101010 back as 42. Leading zeros are not required.
Worked example: decimal 42
From decimal to binary, 42 is 101010. The same integer is 52 in octal and 2A in hexadecimal.
\[ 42_{10}=101010_{2}=52_{8}=2\mathrm{A}_{16} \]
Frequently asked questions
What is 42 in binary?
101010.
What is 42 in hexadecimal?
2A.
What is 42 in octal?
52.
Why was a letter rejected?
A through F are digits only in base 16.
Does this show a negative bit pattern?
No. Use the two’s complement page for a fixed width and a sign bit.
References
Assumptions and limitations
Non-negative integers only. No fractional bases and no two’s-complement width.