Programming tool
Number Base Converter
Convert integers between binary, octal, decimal, and hexadecimal in one place.
Integers only. A leading minus sign is supported.
Equivalent values
————What are number bases?
A number base tells you how many unique digits are used before a new place value begins. This converter works with whole integers in binary, octal, decimal, and hexadecimal.
Binary, octal, decimal, and hexadecimal
Binary is base 2 and is the language of digital circuits. Octal is base 8 and can compactly represent groups of three binary digits. Decimal is base 10, the everyday counting system. Hexadecimal is base 16; its digits A through F represent values 10 through 15.
Programmers use hexadecimal because one hex digit maps neatly to four binary bits. That makes long binary values easier to read, while keeping their exact bit pattern visible. Prefixes such as 0b, 0o, and 0x commonly identify binary, octal, and hexadecimal values in code.
How base conversion works
To convert a positive integer from another base to decimal, multiply each digit by its base raised to that digit's position, starting at zero on the right. To convert decimal to another base, repeatedly divide by the target base and read the remainders from bottom to top. Negative values keep the minus sign while their magnitude is converted.
Binary place values
From right to left, binary places represent powers of two: 1, 2, 4, 8, 16, 32, and so on. For example, 1010 has a 1 in the eight's place and a 1 in the two's place, so its decimal value is 8 + 2 = 10.
Frequently asked questions
Does this converter support negative numbers?
Yes. Enter a minus sign before the digits, such as -42. The sign is retained in every representation.
Can I convert very large integers?
Yes. The converter uses exact BigInt arithmetic instead of JavaScript Number, so values larger than Number.MAX_SAFE_INTEGER remain accurate.
Why is my input rejected?
Each base permits a specific digit range. Binary allows 0-1, octal 0-7, decimal 0-9, and hexadecimal 0-9 plus A-F. This tool does not accept fractions or decimal points.