Number Base Converter: Binary to Decimal, Hex and Octal

Convert between binary, octal, decimal, hexadecimal and any base.

Number Base Converter tool

Common bases

8
Bits required
11111111
Grouped into bytes

Any base from 2 to 36

About the Number Base Converter

Computer science students, programmers and electronics hobbyists constantly move between number systems. This converter shows the same value in binary, octal, decimal and hexadecimal at once, so typing into any box updates the others: 255 is 11111111 in binary, 377 in octal and FF in hexadecimal. It works as a binary to decimal converter with the positional working shown step by step, which helps when learning or checking homework, and it handles very large numbers exactly. For arithmetic in other bases, use the Binary Calculator or the Hex Calculator.

Beneath the four main boxes is a custom converter for any base from 2 to 36, which uses 0 to 9 and then the letters A to Z as digits. It covers base 32 encodings, the base 36 strings some systems use for short identifiers, and classroom exercises in unusual bases such as base 5 or base 12.

Each field only accepts digits that exist in its base, so typing a 2 into the binary box or a G into the hexadecimal box produces a clear message instead of a wrong answer. Underneath, a panel reports how many bits the value needs and shows it split into bytes, which is exactly what you want to see when the number came from a hardware register, a file permission or a colour code. Programmers meet these bases constantly: hexadecimal in colour codes and memory addresses, binary in flags and permissions, octal in Unix file modes.

How to use the Number Base Converter

  1. Type into any boxUse binary, octal, decimal or hexadecimal, whichever form your number is in; prefixes such as 0x are not needed.
  2. Watch the rest changeThe other three boxes update with every digit you type, so mistakes show up immediately.
  3. Try another baseThe custom boxes convert to and from any base between 2 and 36.
  4. Copy a valueEach box has its own copy button.

Number Base Converter features

  • Binary, octal, decimal and hexadecimal kept in sync
  • Custom conversion for any base from 2 to 36
  • Input checked against each base with clear messages
  • How many bits the value needs, with an eight-bit grouped view
  • Exact results for very large whole numbers
  • One-click copy for every form

Common uses

  • Reading a permission value or bit flag from a log
  • Turning an RGB channel number into its two-character hex form
  • Checking homework on number systems
  • Working out a subnet mask or port number in another base
  • Porting a numeric constant from C code into Python or JavaScript

Number bases in practice: exam-style conversions, grouping shortcuts, base 36 IDs, colours, permissions and integer limits

By the FreeToolsWorld editorial team · Updated November 2026 · How we write and check our guides

Binary, octal, decimal and hexadecimal are the same numbers in different clothes, and moving between them is a core skill in computer science courses and everyday programming. This guide works through an exam-style conversion using the grouping shortcuts that save time, then shows where bases appear in practice: short IDs in base 36, colour codes, file permissions and the integer limits that occasionally break real systems.

A worked example: one number, four bases

An exam asks for 156 in binary, octal and hexadecimal. Repeated division by 2 gives binary 10011100. From there, grouping saves work. For octal, group the bits in threes from the right, 010 011 100, giving 2, 3 and 4, so octal 234. For hexadecimal, group in fours, 1001 1100, giving 9 and C, so 9C. The converter shows all four at once, which makes it ideal for checking working step by step.

Why grouping works

Eight is two to the power three and sixteen is two to the power four, so each octal digit corresponds to exactly three bits and each hex digit to exactly four. That is why programmers prefer hexadecimal for binary data: a byte is always exactly two hex digits, and the conversion can be done in your head once the sixteen four-bit patterns are familiar.

For students

Number systems appear in school and college computer science courses, including O Level and intermediate syllabuses in Pakistan, as well as university programmes. Common exam slips include reading remainders in the wrong order, forgetting that A to F represent 10 to 15, and dropping leading zeros when a full byte is requested. Converting the answer back to decimal is a quick self-check.

Base 36 identifiers

Base 36 uses all ten digits and twenty-six letters, producing short, URL-friendly identifiers. The number 123,456,789 becomes just 21i3v9 in base 36. Some link shorteners and order reference systems use this approach to keep codes short. Case is usually ignored in base 36, which makes codes easier to read aloud than case-sensitive alternatives.

Colours in hexadecimal

Web colours are three hexadecimal byte values. In #1E90FF, the pairs 1E, 90 and FF are 30, 144 and 255 in decimal, the red, green and blue intensities. Reading colours this way helps when adjusting a shade by hand or converting a colour for a program that expects decimal values.

Permissions in octal

Unix file permissions are written in octal because each permission group, owner, group and others, has three bits: read, write and execute. Mode 755 is binary 111 101 101, meaning the owner has all three permissions while others can read and execute. Octal remains in use mainly for this reason.

Integer limits

Many systems store whole numbers in 32 bits. A signed 32-bit integer tops out at 2,147,483,647, the largest value with 31 bits set. Counters and IDs that approach this limit must move to 64-bit types; YouTube famously upgraded its view counter after a hugely popular video neared the 32-bit limit. Seeing the binary length of a value shows how close it is to such limits.

Bytes and storage

One byte holds values from 0 to 255, two bytes up to 65,535 and four bytes over four billion. Choosing database column types and file formats starts from these ranges. The bit length panel in the converter shows how many bits a value needs, which helps choose the smallest type that will safely hold it.

Other bases in daily life

Time uses base 60 for minutes and seconds, a legacy of ancient Babylonian mathematics, while dozens and grosses echo base 12. Trying these in the custom converter is a good way to understand that place value works the same in every base: only the number of symbols changes.

Common mistakes

  • Reading division remainders from top to bottom instead of bottom to top.
  • Grouping bits from the left rather than the right.
  • Forgetting that hex letters stand for 10 to 15.
  • Ignoring integer limits when choosing storage types.

Related tools

For step-by-step decimal to binary working, use Decimal to Binary Converter. To read hex values, try Hex to Decimal Converter, and to work with octal permissions, Chmod Calculator.

Bases in spreadsheets

Excel and Google Sheets include functions such as DEC2BIN, DEC2HEX, BIN2DEC and HEX2DEC. DEC2BIN handles only values from −512 to 511, because its result is limited to ten bits, so larger numbers need the BASE function instead. These functions are handy for converting whole columns, such as lists of colour or error codes.

Bases in programming languages

In JavaScript, (156).toString(2) returns the binary text and parseInt('9c', 16) reads a hex value back into a number. Python offers bin, oct and hex for output and int('9c', 16) for input. Checking a script's output against the converter for a few values confirms that your code handles bases correctly.

Privacy

Conversions run in your browser. Nothing you enter is sent anywhere or stored.

Frequently asked questions

Why is hexadecimal so popular with programmers?

Each hexadecimal digit stands for exactly four bits, so one byte is always two digits and converting to binary is immediate. Base ten has no neat relationship with bits, so engineers prefer hex for addresses, colours and byte values.

How big a number can I convert?

Very big ones. The converter uses big-integer arithmetic, so a number with sixty digits converts without its final digits being rounded away, which is exactly where ordinary calculators and simple converters fail.

Can it handle negative numbers?

Yes, using a minus sign in front. That gives a plain negative value, not the two's complement form computers use internally, which depends on a fixed word size such as 8 or 32 bits and is a different calculation.

Can I convert numbers with a fractional part?

No, only whole numbers are supported. Fractions in other bases raise their own rounding questions, since many simple decimal fractions never end in binary, so that is treated as a separate problem.

Why does the custom converter stop at base 36?

Its digits are 0 to 9 followed by A to Z, which gives exactly thirty-six symbols. Going higher would need extra symbols that nobody has agreed on, so base 36 is the natural upper limit.

What is the bit length panel for?

It shows how many binary digits the value needs, which tells you whether it fits in 8, 16, 32 or 64 bits. The byte view splits the same value into groups of eight so long binary numbers are easier to read and compare.