ToolNest

Number Base Converter

Free number base converter. Convert numbers between binary, octal, decimal and hexadecimal instantly, with validation and one-click copy.

Binary (base 2)

101010

Octal (base 8)

52

Decimal (base 10)

42

Hexadecimal (base 16)

2A

Binary, octal, decimal and hexadecimal are four ways of writing the same number. Converting between them by hand is error-prone, and the conversions come up constantly in programming, networking, colour work and low-level debugging.

Enter a number in any base and see it in all four instantly, with validation that catches invalid digits before they produce a wrong answer.

How to use the Number Base Converter

  1. Choose the input base

    Binary (2), octal (8), decimal (10) or hexadecimal (16).

  2. Type your number

    Only digits valid for that base are accepted — 2 is rejected in binary, and G in hex.

  3. Read all four representations

    Every base updates simultaneously as you type.

  4. Copy any result

    One click copies the value you need.

The four bases

BaseDigitsDecimal 255 looks likeUsed for
Binary (2)0–111111111Machine representation, bit flags, permissions
Octal (8)0–7377Unix file permissions
Decimal (10)0–9255Everyday arithmetic
Hexadecimal (16)0–9, A–FFFColours, memory addresses, MAC addresses

Why hexadecimal is everywhere in computing

One hex digit represents exactly four bits, so two hex digits represent one byte precisely. That clean mapping is why hex is used wherever bytes are discussed: #FF0000 is three bytes of colour, 0x7FFF is a memory address, 00:1A:2B:3C:4D:5E is a MAC address.

Binary is unreadable at length — 11111111 00000000 00000000 is hard to check by eye — while FF0000 conveys the same thing in six characters, and each digit still maps back to four bits unambiguously.

Converting by hand

To decimal: multiply each digit by its base raised to the position, counting from zero on the right. Binary 1011 is 1×8 + 0×4 + 1×2 + 1×1 = 11.

From decimal: divide repeatedly by the base and read the remainders bottom to top. 11 ÷ 2 gives remainders 1, 1, 0, 1 — read upward, 1011.

Binary to hex is easiest of all: group the bits in fours from the right and convert each group. 11010110 becomes 1101 0110 becomes D6.

Unix file permissions

The octal permission numbers in chmod are three groups of three bits: read is 4, write is 2, execute is 1, added together for each of owner, group and others.

OctalBinaryPermissionsMeaning
755111 101 101rwxr-xr-xStandard for executables and directories
644110 100 100rw-r--r--Standard for regular files
600110 000 000rw-------Private — SSH keys must be this
777111 111 111rwxrwxrwxEveryone can do anything — almost always wrong

Prefixes that signal a base

  • `0x` — hexadecimal. 0xFF is 255.
  • `0b` — binary. 0b1010 is 10.
  • `0o` — octal in modern languages. 0o755 is 493.
  • A bare leading zero means octal in C, Java and older JavaScript — which is why 012 is 10, not 12. This has caused real bugs in date handling and is why modern languages require the explicit 0o prefix.

Frequently asked questions

How do I convert binary to decimal?

Multiply each digit by 2 raised to its position from the right, starting at zero, and add the results. Binary 1011 is 8 + 0 + 2 + 1 = 11.

Why does computing use hexadecimal?

Because one hex digit maps to exactly four bits and two digits to one byte. It expresses binary data compactly without losing the bit-level correspondence.

What does 0x mean?

It is the prefix marking a hexadecimal literal in most programming languages. 0xFF is 255 in decimal.

What is octal used for today?

Mainly Unix file permissions in chmod, where three octal digits encode read, write and execute bits for owner, group and others.

Can it convert negative numbers?

It handles positive integers. Negative values in binary are usually represented as two’s complement, which depends on the word size — 8, 16, 32 or 64 bits — and so needs a context this tool does not assume.

What is the largest number it handles?

Integers up to JavaScript’s safe limit of 2^53 − 1. Beyond that, precision is lost, which is a limitation of the number type rather than the conversion.

How do I convert binary to hex quickly?

Group the bits in fours from the right and convert each group to a single hex digit. 11010110 is 1101 0110 is D6.

Why is 012 sometimes 10?

Because a leading zero means octal in C, Java and older JavaScript, so 012 is octal 12, which is decimal 10. Modern languages require 0o to avoid exactly this confusion.

100% private. Files are processed on your device and never uploaded.

Instant results. No upload queue. Processing time depends on your device.

Free forever. No signup, no watermark, no paid tier.

Works everywhere. Use a modern browser on your phone or computer.

Related tools

Number Base Converter is one of all the free tools on ToolNest. No account or subscription needed — anywhere in the world.