IT Market
Tools/Math/Converters/Number Base Converter Online — Binary, Hex, Octal
Системы счисления

Конвертер между различными системами счисления

Tool guide

Number Base Converter Online — Binary, Hex, Octal

This converter turns a whole number from one base into another: binary, octal, decimal or hexadecimal. Type the value into the number field, choose the source base and the target base in the two dropdowns, then press convert to see the digits and copy them. The maths runs in the page itself, so nothing you type leaves the browser. Handy for reading a subnet mask or decoding a hex error code. See also: convert an IP address to decimal and back, get the hex character codes of a string, decode a run of binary back into text.

How to use it

  1. Type your value into the «Number» field; the placeholder shows 42 as a sample.
  2. Use the «From base» dropdown to say which base the number is written in: 2, 8, 10 or 16.
  3. Use the «To base» dropdown to pick the base you want; the same four options are offered.
  4. Press «Convert» and the converted digits appear right below the form.
  5. Press «Copy» to put the result on the clipboard and paste it into your code.
  6. To verify, swap the two dropdowns around and convert the result back to the original base.

FAQ

How do I convert a binary number to decimal?

Set the «From base» dropdown to binary (2), set «To base» to decimal (10), type your string of ones and zeros into the number field and press the convert button. For instance 1101 becomes 13. Do not separate the digits with spaces, dashes or underscores — the parser expects an unbroken run of digits and will report an invalid value otherwise.

Which bases are supported?

Both dropdowns offer the same four bases: binary (2), octal (8), decimal (10) and hexadecimal (16). Unusual radixes such as base 3 or base 36 are not on the list, because the options are hard-coded. Any pairing of the four is allowed though, so you can go hex to binary, octal to decimal and back again — twelve directions in total.

Can it handle fractions or negative numbers?

No. The tool works on non-negative whole numbers only. A minus sign, a decimal point or a comma will make the parser reject the input. For a fractional value, convert the integer part here and work out the fractional digits separately; for negative values in two's complement you will need a dedicated programmer's calculator.

Why does the hexadecimal output have no 0x prefix?

The result is the bare digit string, for example cd rather than 0xcd. Prefixes and suffixes belong to particular languages and formats, not to the number itself: 0x in C and JavaScript, a trailing h in assembly listings, a leading # for CSS colours. Add whichever wrapper your context needs after you copy the value.

Does letter case matter for hex input?

It does not. 1a2b and 1A2B are read as the same value, so you can type in whichever case is convenient. The output always comes back in lower case letters. If your coding standard or document requires upper case hex, convert the copied string yourself — this tool will not change the case for you.

Is there a limit on how long the number can be?

The practical ceiling is JavaScript's exact integer range, roughly 9,000,000,000,000,000 or two to the power of 53. Longer inputs such as 64-bit identifiers, hashes or key fingerprints lose their low-order digits and the answer comes out wrong. Use a calculator with arbitrary-precision arithmetic for values of that size.

Does the site see the numbers I enter?

No. The conversion is done by a small script inside the page itself, so what you type stays in the browser tab and never reaches a server log. A pleasant side effect: once the page has loaded, it keeps converting even if your connection drops, right up until you reload it.

Examples

Reading a subnet mask
Before: 255, decimal (10) to binary (2)
After: 11111111 — eight set bits, one full mask octet
chmod permission bits
Before: 111101101, binary (2) to octal (8)
After: 755 — the familiar directory permission string
A CSS colour channel
Before: 205, decimal (10) to hexadecimal (16)
After: cd — the byte you drop into #cd0000