toolbench.onlineby Valkyron Labs

Converters

Number Base Converter

Convert a whole number between binary, octal, decimal, and hexadecimal. Hex comes out uppercase. A fraction stops at the dot. The conversion stays on this page.

Number Base Converter

Convert one whole number between binary, octal, decimal, and hexadecimal.

Ready to convert.

All bases

—

Output actions

Ready to copy output once your result appears.

One integer, four bases

Number Base Converter reads one whole number in the base you pick and prints binary, octal, decimal, and hexadecimal together. Hex on the result is uppercase. The field is not a byte dump and it is not a fraction. A dot, a letter that the base does not allow, or a second number after a separator ends the read.

How to convert a base

  1. 1Type the numeral in Input number. The box starts empty and the placeholder is 255. Spaces at the ends are ignored. A leading plus is accepted. A leading minus is kept and printed on every line.
  2. 2Set Input base to Binary (2), Octal (8), Decimal (10), or Hexadecimal (16). Decimal (10) is selected when the page opens.
  3. 3Press Convert. All bases lists the four lines. Press Copy output for those lines. There is no download. An empty box says Please enter a number. and leaves the previous lines in place.

What it is good for

  • • Reading 255 as binary 11111111, octal 377, decimal 255, and hex FF in one block.
  • • Checking a hex byte such as FF or ff without adding a 0x yourself.
  • • Seeing that a dotted address or a decimal fraction is cut at the first character the base rejects.

Example

Input

255 with Decimal (10) selected

Output

Binary (base 2):      11111111
Octal (base 8):       377
Decimal (base 10):    255
Hexadecimal (base 16): FF

ff or FF with Hexadecimal (16), 11111111 with Binary (2), and 377 with Octal (8) print the same four lines. The hex line is always uppercase.

How one integer becomes four lines

Convert trims the field and parses it as an integer in the selected base. The same integer is then written four ways. Binary uses digits 0 and 1 with no 0b prefix and no fixed width, so decimal 10 is 1010 rather than 00001010. Octal uses digits 0 through 7. Decimal is the ordinary base-10 spelling. Hexadecimal uses 0 through 9 and A through F, and that line is passed through uppercase, so ff in the field becomes FF on the result. The labels are fixed: Binary (base 2), Octal (base 8), Decimal (base 10), and Hexadecimal (base 16). The spaces after each colon line the values up. They are part of the copied text.

A minus sign is allowed. Decimal -5 prints Binary (base 2): -101, Octal (base 8): -5, Decimal (base 10): -5, and Hexadecimal (base 16): -5. That is a sign plus the digits of the absolute value. It is not a two's-complement bit pattern, and there is no width control that would turn -5 into a 32-bit hex word. A plus sign is accepted and then dropped, so +255 matches 255. Letters in a hex field may be either case. 0x10 in the hexadecimal base is 16, because a leading 0x is treated as a prefix there. The same characters in the decimal base stop at x, and the value is 0.

The base menu and the Convert button

Input base has four options and no free-typed radix. You cannot ask for base 36 or base 3. The menu does not change the result by itself. Convert is the button that rewrites All bases. The status line starts at Ready to convert. A successful click says Converted successfully. Copy output copies the four lines from the latest success. If you change the base and forget to click, the copied block is still the previous integer.

An empty field, or a field that is only spaces, sets the status to Please enter a number. and does not replace All bases. A first character the base cannot read, such as 2 with Binary (2) selected, or 8 with Octal (8) selected, sets the status to a sentence of the form "2" is not a valid Binary number. The previous block stays. Digits that are legal at the start are kept even when later characters are not, which is the next section.

When a single integer is the right job

Use this page when you have one integer and you want the other three spellings. A subnet prefix of 28, or a single octet such as 240, can be pasted alone. The IPv4 CIDR calculator already prints a netmask as dotted decimal and does not print that mask in binary or hex. Do not paste the whole quad here. 192.168.0.1 in decimal stops at the dot and becomes 192.

Text turned into bytes is a different tool. Hex encode / decode writes each UTF-8 byte of a string as a lowercase pair separated by spaces, so the letter A is 41, not the integer conversion of the word A. Binary encode / decode writes code points as binary groups padded to at least eight bits. Decimal 65 on this page is binary 1000001, with no leading zero. The byte size calculator counts UTF-8 and UTF-16 storage. It does not renumber a base.

Where the read stops

The parser does not require every character to be a legal digit. It stops at the first character that is illegal in the selected base and keeps what it already accepted. Decimal 12abc is 12. Decimal 10.5 is 10. Decimal 1e2 is 1, because e is not a decimal digit. Binary 0b10 is 0, because 0 is legal and b stops the read. Those clicks succeed. They do not warn that characters were ignored. If the result looks smaller than the field, look for a dot, a prefix, or a trailing note.

Only integers survive. There is no fractional binary and no hex point. Values past 9007199254740991 are not exact: 9007199254740993 is stored as 9007199254740992 before the four lines are built, so the decimal line can disagree with the digits you typed. Leading zeros do not select a base. Decimal 010 is 10. Octal 010 is 8, and only because you chose Octal (8). The page does not group digits with spaces or underscores, and an underscore in the field ends the read.

Rules and limitations

One trimmed integer, in Binary (2), Octal (8), Decimal (10), or Hexadecimal (16). Output is four labeled lines. Hex is uppercase, with no 0x and no padding. A leading minus is reprinted on every line.

A dot, an exponent, or any illegal digit ends the parse and the prefix is kept. A completely illegal field leaves the previous lines and names the base in the status. Copy output copies the four lines. There is no download and no fractional mode.

Common problems

If a dotted quad became a single small integer, the dot ended the read. Paste one octet or the prefix. If 10.5 became 10, the fraction was never converted.

If 0x10 in decimal became 0, the x stopped a decimal parse. Switch Input base to Hexadecimal (16) when the 0x prefix should be honored. If the decimal line lost a low digit on a huge integer, the value is past 9007199254740991.

Frequently asked questions

Which bases can I enter?

Binary (2), Octal (8), Decimal (10), and Hexadecimal (16). The result always shows all four. There is no other radix.

Why is 10.5 converted as 10?

The read stops at the dot. Only the whole part is used, and the click still counts as a success. This page does not convert a fractional part.

Does hex output include 0x?

No. The hex line is uppercase digits only. FF is the hex line for 255. A 0x prefix is recognized only on input, and only when Hexadecimal (16) is selected.

Will a negative number show two's complement?

No. Decimal -5 is printed as -101 in binary, -5 in octal and decimal, and -5 in hex. The minus sign is kept. The bits of a fixed-width word are not.

Is my input uploaded or saved?

This tool processes input in your browser and does not save its input or output to local storage. Copy and download are user actions. The site uses analytics for page and action metadata and may use ads and production error reporting; see the Privacy Policy for those services.

About this tool

Maintained by Toolbench. For large or deeply nested files, split the input into smaller batches and verify representative results before using them in an import or application. Report reproducible problems through Contact.

Next steps

Related tools

Continue the workflow with nearby tools for formatting, publishing, debugging, or follow-up checks.

Trust

Policies, contact, and answers

Clear pages for how Toolbench works, what we collect, and how to reach us.