Converter

Hex Decimal Octal Binary Converter | Number Base Calculator

Convert between hexadecimal, decimal, octal and binary with a free number base calculator plus formulas, tables, examples and computing use cases.
Hex decimal octal binary converter illustration showing number system conversion with digital interface and code elements

Number base conversion tool and guide

Hex/decimal/octal/binary Converter

Convert integers between hexadecimal, decimal, octal, and binary, then learn the exact rules behind each conversion. This page is built for students, programmers, computer science teachers, network engineers, and anyone who needs a reliable way to move between base \(16\), base \(10\), base \(8\), and base \(2\).

Decimal: base 10 Hexadecimal: base 16 Octal: base 8 Binary: base 2

Convert between hex, decimal, octal, and binary

Enter a value in one box and select Convert All. The converter accepts common prefixes such as 0x for hexadecimal, 0b for binary, and 0o for octal. Spaces and underscores are ignored, which makes grouped binary values easier to paste.

Allowed digits: 0 to 9

Allowed symbols: 0 to 9 and A to F

Allowed digits: 0 to 7

Allowed digits: 0 and 1

What hex, decimal, octal, and binary mean

A number system is a way of writing quantities using a fixed base. Decimal uses base \(10\), which means each place is worth a power of \(10\). Binary uses base \(2\), octal uses base \(8\), and hexadecimal uses base \(16\). The same quantity can be written in any of these systems. For example, the decimal number \(255\) is \(11111111\) in binary, \(377\) in octal, and \(FF\) in hexadecimal. The value is the same; only the notation changes.

Decimal is the system people use in everyday arithmetic. It has ten symbols, \(0\) through \(9\), and place values \(1,10,100,1000,\ldots\). Binary is the system used at the hardware level of digital computers. It has only two symbols, \(0\) and \(1\), which match two electrical states such as off and on or low voltage and high voltage. Octal groups binary digits into blocks of three, which made it convenient in many older computing environments. Hexadecimal groups binary digits into blocks of four, which makes it extremely useful for modern computing because one byte is exactly two hex digits.

The key to using this converter well is understanding that a base does not change the value of a number. It changes how that value is represented. A base \(b\) number uses powers of \(b\). In decimal, \(345\) means \(3\times10^2+4\times10^1+5\times10^0\). In octal, \(345_8\) means \(3\times8^2+4\times8^1+5\times8^0\), which equals \(229_{10}\). In hexadecimal, \(345_{16}\) means \(3\times16^2+4\times16^1+5\times16^0\), which equals \(837_{10}\). The written digits may look identical, but the base determines their meaning.

If you are studying computer science, number systems appear everywhere: binary arithmetic, memory addresses, RGB color values, file permissions, bit masks, character encodings, networking identifiers, debugging output, and low-level data representation. RevisionTown also has focused tools for one-way conversions, such as the binary to decimal converter, decimal to binary converter, hex to decimal converter, and decimal to hex converter. This page is for the broader multi-base workflow where you want all four major representations at once.

The place value formula for any base

Every positional number system follows the same rule. If a number in base \(b\) has digits \(d_n,d_{n-1},\ldots,d_1,d_0\), then its decimal value is found by multiplying each digit by the corresponding power of the base and adding the results:

\[(d_nd_{n-1}\ldots d_1d_0)_b=\sum_{i=0}^{n}d_i b^i.\]

The rightmost digit is multiplied by \(b^0=1\). The next digit is multiplied by \(b^1\). The next is multiplied by \(b^2\), and so on. This is why position matters. In base \(10\), moving one place left multiplies the place value by \(10\). In base \(2\), moving one place left multiplies the place value by \(2\). In base \(16\), moving one place left multiplies the place value by \(16\).

The allowed digits depend on the base. Binary allows only \(0\) and \(1\). Octal allows \(0\) through \(7\). Decimal allows \(0\) through \(9\). Hexadecimal needs sixteen symbols, so it uses \(0\) through \(9\) and the letters \(A,B,C,D,E,F\), where \(A=10\), \(B=11\), \(C=12\), \(D=13\), \(E=14\), and \(F=15\). A digit must always be smaller than the base. That is why \(8\) is invalid in octal and \(2\) is invalid in binary.

Core rule: To interpret any base-\(b\) number, multiply each digit by a power of \(b\), starting with \(b^0\) at the rightmost digit.

Common hex, decimal, octal, and binary conversions

The table below shows the values from \(0\) to \(16\). These small values are worth memorizing because they appear repeatedly in byte values, bit masks, binary grouping, permissions, and hexadecimal color work.

DecimalHexadecimalOctalBinary
0000
1111
22210
33311
444100
555101
666110
777111
88101000
99111001
10A121010
11B131011
12C141100
13D151101
14E161110
15F171111
16102010000

How to convert decimal to binary, octal, or hexadecimal

To convert from decimal to another base, use repeated division by the target base. Divide the decimal number by the base, record the remainder, then divide the quotient again. Continue until the quotient becomes \(0\). The answer is the sequence of remainders read from bottom to top. This method works because each division extracts the next digit from the right side of the target-base representation.

For decimal to binary, divide by \(2\). Convert \(13_{10}\) to binary:

\[ 13\div2=6\text{ remainder }1,\quad 6\div2=3\text{ remainder }0,\quad 3\div2=1\text{ remainder }1,\quad 1\div2=0\text{ remainder }1. \]

Reading the remainders upward gives \(1101_2\). You can verify by place value: \(1\times2^3+1\times2^2+0\times2^1+1\times2^0=8+4+0+1=13\).

For decimal to octal, divide by \(8\). Convert \(100_{10}\) to octal:

\[ 100\div8=12\text{ remainder }4,\quad 12\div8=1\text{ remainder }4,\quad 1\div8=0\text{ remainder }1. \]

The result is \(144_8\). Checking the value gives \(1\times8^2+4\times8^1+4\times8^0=64+32+4=100\).

For decimal to hexadecimal, divide by \(16\). Convert \(255_{10}\) to hex:

\[ 255\div16=15\text{ remainder }15,\quad 15\div16=0\text{ remainder }15. \]

In hexadecimal, remainder \(15\) is written as \(F\), so \(255_{10}=FF_{16}\). This value is common because \(255\) is the maximum unsigned value that fits in \(8\) bits: \(11111111_2=FF_{16}=255_{10}\).

How to convert binary, octal, or hex to decimal

To convert any base back to decimal, use the place value expansion. Binary uses powers of \(2\), octal uses powers of \(8\), and hexadecimal uses powers of \(16\). This method is direct, reliable, and easy to check.

For binary to decimal, convert \(1010_2\):

\[ 1010_2=1\times2^3+0\times2^2+1\times2^1+0\times2^0=8+0+2+0=10_{10}. \]

Only the \(1\)-bits contribute. That is why binary conversion becomes faster once you memorize powers of \(2\): \(1,2,4,8,16,32,64,128,256,512,1024,\ldots\). For example, \(10000000000_2=1024_{10}\) because the single \(1\) is in the \(2^{10}\) position.

For octal to decimal, convert \(377_8\):

\[ 377_8=3\times8^2+7\times8^1+7\times8^0=192+56+7=255_{10}. \]

For hexadecimal to decimal, convert \(1A3_{16}\):

\[ 1A3_{16}=1\times16^2+10\times16^1+3\times16^0=256+160+3=419_{10}. \]

When converting hex, remember to replace \(A\) through \(F\) with their decimal values. \(A\) is \(10\), \(B\) is \(11\), \(C\) is \(12\), \(D\) is \(13\), \(E\) is \(14\), and \(F\) is \(15\). Uppercase and lowercase letters represent the same values, so \(ff_{16}=FF_{16}\).

Direct shortcuts between binary, octal, and hexadecimal

Binary, octal, and hexadecimal have a special relationship because \(8=2^3\) and \(16=2^4\). That means one octal digit corresponds exactly to \(3\) binary bits, and one hex digit corresponds exactly to \(4\) binary bits. You can convert directly between these systems without going through decimal.

To convert binary to hexadecimal, group the binary digits from the right into blocks of four. Pad the leftmost group with zeros if needed. Then replace each group with the matching hex digit. For example:

\[ 11010101_2=1101\;0101_2=D5_{16}. \]

The group \(1101_2\) is \(13_{10}\), which is \(D_{16}\). The group \(0101_2\) is \(5_{10}\), which is \(5_{16}\). Therefore \(11010101_2=D5_{16}\). For the reverse direction, replace each hex digit with its four-bit binary equivalent. \(D5_{16}=1101\,0101_2\).

To convert binary to octal, group from the right into blocks of three. For example:

\[ 11010101_2=011\;010\;101_2=325_8. \]

The left group was padded as \(011\). The groups \(011\), \(010\), and \(101\) become \(3\), \(2\), and \(5\). For the reverse direction, replace each octal digit with its three-bit binary equivalent. \(377_8=011\,111\,111_2\), which is \(11111111_2\) after dropping the leading zero.

This grouping shortcut is the reason hexadecimal and octal are useful for humans who work with binary. Long binary strings are hard to read and easy to mistype. Hexadecimal compresses every four bits into one symbol, while octal compresses every three bits into one symbol. Modern programming mostly favors hexadecimal, but octal remains important in Unix permissions and some legacy contexts.

Base relationship explorer

Choose a relationship to review the exact grouping rule and a quick example.

Comparison of the four systems

SystemBaseAllowed symbolsPlace valuesCommon use
Decimal100 to 9\(1,10,100,1000,\ldots\)Human arithmetic, measurement, finance, and general communication.
Binary20 and 1\(1,2,4,8,16,\ldots\)Digital logic, CPU operations, bit masks, storage, and hardware states.
Octal80 to 7\(1,8,64,512,\ldots\)Unix permissions, legacy computing, and compact three-bit grouping.
Hexadecimal160 to 9, A to F\(1,16,256,4096,\ldots\)Memory addresses, byte values, colors, checksums, debugging, and networking identifiers.

Why number base conversion matters in computing

Number systems are not only a classroom topic. They are part of the daily language of computing. Binary is closest to the physical machine because digital circuits store and process bits. Hexadecimal is the human-friendly view of those bits. Decimal is the way people usually describe quantities. Octal is less common than hex today, but it remains valuable in permissions and systems history.

A byte contains \(8\) bits. Since one hex digit represents \(4\) bits, one byte is exactly two hex digits. The binary byte \(11111111_2\) is \(FF_{16}\), which is \(255_{10}\). That relationship explains why \(255\) appears in RGB color channels, subnet masks, unsigned byte limits, and many programming examples. If you understand the base conversion, the number \(255\) stops looking arbitrary.

Web colors use hexadecimal because each color channel is one byte. A color such as #3A7BD5 has red \(3A_{16}\), green \(7B_{16}\), and blue \(D5_{16}\). Converting those to decimal gives red \(58\), green \(123\), and blue \(213\). If you work with color values often, RevisionTown's hex to RGB conversion and RGB to hex conversion pages focus specifically on that color workflow.

Unix permissions are a practical octal example. A mode such as 755 is not a decimal number in that context. It is three octal digits. Each digit corresponds to three permission bits: read, write, and execute. The digit \(7_8\) is \(111_2\), so it means read, write, and execute. The digit \(5_8\) is \(101_2\), so it means read and execute but not write. Therefore 755 means owner \(rwx\), group \(r-x\), and others \(r-x\).

Networking also uses hexadecimal. MAC addresses are usually written as six hex byte pairs, such as 00:1A:2B:3C:4D:5E. IPv6 addresses are written in groups of hexadecimal digits because the full address is \(128\) bits long. Hex keeps the address readable while preserving a direct connection to binary. Debuggers, packet analyzers, and hardware tools also use hexadecimal because it is compact and maps cleanly to bytes.

Character encoding gives another useful example. ASCII code \(65_{10}\) represents the uppercase letter A, which is \(41_{16}\) in hex and \(1000001_2\) in binary. For text-focused conversions, use the ASCII, hex, binary, decimal, and Base64 converter, the ASCII text to binary converter, or the string to binary converter. Those pages target text encoding, while this page targets integer base conversion.

Worked examples

Example 1: Convert \(255_{10}\) to binary, octal, and hex

Repeated division by \(2\) gives eight remainders of \(1\), so \(255_{10}=11111111_2\). Grouping the binary into four-bit blocks gives \(1111\,1111_2=FF_{16}\). Grouping into three-bit blocks gives \(011\,111\,111_2=377_8\). Therefore:

\[255_{10}=11111111_2=377_8=FF_{16}.\]

Example 2: Convert \(1A3_{16}\) to decimal and binary

Use the place value formula:

\[ 1A3_{16}=1\times16^2+10\times16^1+3\times16^0=256+160+3=419_{10}. \]

For binary, convert each hex digit to four bits: \(1=0001\), \(A=1010\), and \(3=0011\). Therefore \(1A3_{16}=000110100011_2\), which is usually written as \(110100011_2\) after removing leading zeros.

Example 3: Convert \(377_8\) to decimal and hex

First convert to decimal:

\[ 377_8=3\times8^2+7\times8^1+7\times8^0=192+56+7=255_{10}. \]

Since \(255_{10}=FF_{16}\), the octal value \(377_8\) is \(FF_{16}\). The binary shortcut confirms it: \(3=011\), \(7=111\), \(7=111\), so \(377_8=011111111_2=11111111_2=FF_{16}\).

Example 4: Interpret Unix permission \(755_8\)

Each octal digit maps to three binary bits. The digit \(7_8\) is \(111_2\), and \(5_8\) is \(101_2\). Therefore:

\[ 755_8=111\;101\;101_2. \]

In permission notation, the first group is owner, the second is group, and the third is others. The bits represent read, write, and execute. Thus \(111\) means \(rwx\), and \(101\) means \(r-x\). The permission is \(rwxr-xr-x\).

Example 5: Convert color code #3A7BD5 to decimal RGB

Split the hex code into byte pairs: \(3A\), \(7B\), and \(D5\). Then convert each pair to decimal:

\[ 3A_{16}=3\times16+10=58,\quad 7B_{16}=7\times16+11=123,\quad D5_{16}=13\times16+5=213. \]

So #3A7BD5 is RGB\((58,123,213)\).

Example 6: Convert \(0xBEEF\) to decimal

The prefix 0x means hexadecimal. Ignore the prefix for the arithmetic and expand \(BEEF_{16}\):

\[ BEEF_{16}=11\times16^3+14\times16^2+14\times16^1+15\times16^0. \]

This equals \(11\times4096+14\times256+14\times16+15=45056+3584+224+15=48879_{10}\).

Common mistakes when converting number systems

The most common mistake is treating a number as decimal because it looks familiar. The written string 10 can mean \(10_{10}\), \(2_{2}\), \(8_{8}\), or \(16_{16}\), depending on the base. Always identify the base before interpreting the value. A subscript, prefix, surrounding context, or field label tells you which base is intended.

Another mistake is allowing invalid digits. Binary cannot contain \(2\). Octal cannot contain \(8\) or \(9\). Hexadecimal can contain \(A\) through \(F\), but not letters beyond \(F\). If an input contains invalid symbols, the conversion is not just inconvenient; it is mathematically undefined in that base. The converter validates the digits before calculating results.

Students also mix up grouping direction. For binary to hex or binary to octal, group from the right, not the left. The rightmost bits represent the lowest powers and must stay aligned. If the leftmost group is short, pad it with zeros on the left. Do not add zeros on the right, because that multiplies the value by a power of \(2\).

A fourth mistake is forgetting that leading zeros may matter for fixed-width data. Mathematically, \(00001111_2\) and \(1111_2\) represent the same value. In computing, however, the first form may show an \(8\)-bit byte while the second shows only the minimal representation. The value is the same, but the width can matter for registers, bytes, packet fields, and bit masks.

A final mistake is assuming that hex is a different kind of number from binary. Hex is best understood as compact binary notation. One hex digit is a four-bit group. When you read 0xFF, you can immediately see \(1111\,1111_2\). That mental connection is more useful than converting every hex value through decimal.

How to learn number base conversions efficiently

Start with the powers of the base. For binary, memorize \(2^0\) through \(2^{10}\): \(1,2,4,8,16,32,64,128,256,512,1024\). For octal, know \(1,8,64,512,4096\). For hexadecimal, know \(1,16,256,4096,65536\). These values make place-value expansion much faster.

Next, memorize the \(16\) four-bit patterns for hex digits. This is one of the highest-value skills for computer science. If you know that \(A=1010\), \(B=1011\), \(C=1100\), \(D=1101\), \(E=1110\), and \(F=1111\), you can read bytes, masks, and color values far more quickly. The hex to binary converter and binary to hex converter are useful when you want focused practice on that relationship.

Then practice small values until you can recognize them instantly. Values such as \(15\), \(16\), \(31\), \(32\), \(63\), \(64\), \(127\), \(128\), \(255\), \(256\), and \(1024\) appear constantly. They are one less than a power of two or exactly a power of two. Recognizing them helps with data sizes, masks, byte limits, and binary arithmetic.

Finally, connect each conversion to a real use. Convert a color code. Decode a Unix permission. Interpret a byte. Read a memory address. Translate a bit mask. Number systems become easier when they are not isolated arithmetic exercises. They are part of how computers store, label, and display information.

Manual conversion methods in more detail

Although a converter gives instant results, manual conversion is still worth learning. It helps you understand why the output is correct, spot invalid values, and explain your work in a classroom or technical setting. The most important choice is whether you are converting into decimal or out of decimal. Converting into decimal uses positional expansion. Converting out of decimal uses repeated division. Converting between binary and hex or binary and octal usually uses grouping.

When converting into decimal, write the place values above the digits before doing arithmetic. For example, with \(110101_2\), the place values are \(32,16,8,4,2,1\). The digits are \(1,1,0,1,0,1\). Multiplying and adding gives \(32+16+0+4+0+1=53\). This method also makes errors visible. If you accidentally use \(64\) as the first place value for a six-bit number, the written place-value row will look too long.

For octal, the place values grow faster: \(1,8,64,512,4096,\ldots\). To convert \(2507_8\), expand it as \(2\times8^3+5\times8^2+0\times8^1+7\times8^0\). That gives \(2\times512+5\times64+0+7=1024+320+7=1351_{10}\). Notice that the digit \(0\) still holds a place. It contributes nothing to the sum, but it shifts the values of the digits to its left.

For hexadecimal, convert letters to decimal values before multiplying. Convert \(2B9_{16}\) by writing \(2\times16^2+11\times16^1+9\times16^0\). The value is \(512+176+9=697_{10}\). A common error is to treat \(B\) as if it were a separate variable or to count \(A\) as \(11\). The sequence is \(A=10\), \(B=11\), \(C=12\), \(D=13\), \(E=14\), and \(F=15\).

When converting decimal into another base, repeated division is the safest general method. If the target base is \(b\), each step writes the current number as \(N=qb+r\), where \(q\) is the quotient and \(r\) is the remainder. The remainder is the next digit, starting from the right. Because \(0\le r<b\), the remainder is always a valid digit in base \(b\). You then repeat the process with the quotient until it becomes \(0\).

Consider \(2026_{10}\) to hexadecimal. Divide by \(16\): \(2026\div16=126\) remainder \(10\), so the rightmost digit is \(A\). Next, \(126\div16=7\) remainder \(14\), so the next digit is \(E\). Finally, \(7\div16=0\) remainder \(7\). Reading remainders upward gives \(7EA_{16}\). A check confirms the result: \(7\times256+14\times16+10=1792+224+10=2026\).

For binary, repeated division works, but powers of two can sometimes be faster. To convert \(156_{10}\), find the largest power of two not exceeding \(156\), which is \(128\). Subtract it to get \(28\). The next powers are \(64\) and \(32\), both too large for the remainder, so those bits are \(0\). Then \(16\) fits, leaving \(12\). Then \(8\) fits, leaving \(4\). Then \(4\) fits, leaving \(0\). The remaining lower bits are \(0\). From \(128\) down to \(1\), the bits are \(10011100_2\).

Grouping is the fastest method when binary is already involved. For binary to hex, group into fours from the right. For binary to octal, group into threes from the right. For hex to binary, expand each hex digit into exactly four bits, including leading zeros inside each group. For octal to binary, expand each octal digit into exactly three bits. Only remove leading zeros after the full conversion is complete, and only if the context does not require a fixed width.

Manual conversion also helps you understand why some numbers have familiar forms. A run of \(n\) binary \(1\)-bits equals \(2^n-1\). Therefore \(1111_2=15_{10}\), \(11111111_2=255_{10}\), and \(1111111111_2=1023_{10}\). In hex, these are \(F_{16}\), \(FF_{16}\), and \(3FF_{16}\). Values one less than a power of two appear in masks, byte limits, array bounds, network masks, and binary arithmetic questions.

Prefixes, suffixes, and notation in programming

Different environments mark number bases in different ways. In mathematics, subscripts are common: \(1010_2\), \(12_8\), \(10_{10}\), and \(A3_{16}\). In programming, prefixes are more common. The prefix 0b usually means binary, 0o means octal, and 0x means hexadecimal. Decimal values normally have no prefix. This converter accepts those common prefixes in the matching input fields.

The prefix matters because the same characters can represent different values. The string 10 is ten in decimal, two in binary, eight in octal, and sixteen in hexadecimal. The string 0x10 tells a programmer to read the value as hexadecimal, so it equals \(16_{10}\). The string 0b10 tells the program to read it as binary, so it equals \(2_{10}\). Context is not decoration; it changes the value.

Some older languages and systems used a leading zero to mean octal. In that convention, 010 meant \(8_{10}\), not \(10_{10}\). This caused confusion, especially when beginners wrote values with leading zeros for formatting. Modern languages often prefer 0o for octal because it is explicit. If you are reading legacy code, however, a leading zero may still have special meaning.

Hexadecimal values are often shown with uppercase letters in manuals, registers, color values, and technical documentation. Programming languages usually accept both uppercase and lowercase. 0xff and 0xFF represent the same value. Uppercase is often easier to read in tables and mixed text, which is why this converter displays hex output in uppercase.

Binary values are often grouped for readability. For example, 1111000010100101 may be written as 1111 0000 1010 0101 or 1111_0000_1010_0101. Spaces and underscores make long bit strings easier to inspect. They are not part of the mathematical value, so the converter ignores them. This is useful when pasting values from notes, code comments, or datasheets.

Suffixes can also appear in technical material. A value might be written as 1010b for binary or 377o for octal in some contexts, but prefixes are more consistent across modern programming languages. When in doubt, check the documentation for the language, calculator, assembler, or exam board being used. The safest mathematical notation is still the base subscript, because it explicitly states the base without depending on a programming convention.

Bit width, bytes, and signed values

Mathematical base conversion gives the value of a number, but computing often also cares about width. Width means the number of bits used to store the value. The binary number \(1111_2\) has the same value as \(00001111_2\), but the second form shows an \(8\)-bit field. In a byte-oriented context, those leading zeros are important because they show exactly how the value is stored.

A nibble is \(4\) bits, and a byte is \(8\) bits. One hex digit is one nibble. Two hex digits are one byte. Four hex digits are \(16\) bits. Eight hex digits are \(32\) bits. Sixteen hex digits are \(64\) bits. That is why a \(32\)-bit mask is often written as eight hex digits, such as 0xFFFFFFFF. The same value in binary would take thirty-two characters, which is much harder to scan.

Unsigned values are interpreted as ordinary non-negative integers. An \(8\)-bit unsigned value ranges from \(0\) to \(255\), because \(2^8=256\) possible patterns exist. A \(16\)-bit unsigned value ranges from \(0\) to \(65535\). A \(32\)-bit unsigned value ranges from \(0\) to \(4294967295\). The maximum unsigned value for \(n\) bits is \(2^n-1\).

Signed values require an interpretation rule. Many systems use two's complement. In an \(8\)-bit two's complement system, 11111111 represents \(-1\), even though the same bit pattern as an unsigned integer represents \(255\). The bits did not change; the interpretation changed. This page's converter treats entered values as ordinary integers, but when you read low-level data, you must know whether the value is signed or unsigned.

Two's complement is powerful because addition and subtraction work naturally at the bit level, but it can surprise students. The \(8\)-bit pattern \(10000000_2\) represents \(128\) if unsigned and \(-128\) if signed two's complement. The hex value is \(80_{16}\) either way. A converter can show the base representation, but the program, processor, or data format defines the signed meaning.

Fixed-width overflow is another context issue. If an \(8\)-bit unsigned register stores \(255\) and you add \(1\), the mathematical result is \(256\), but \(256\) requires nine bits: \(100000000_2\). In an \(8\)-bit register, the lower eight bits are \(00000000\), so the stored value wraps to \(0\). This behavior is not a base conversion error. It is a storage-width rule.

When debugging, always ask three questions: What base is this value written in? How many bits wide is the field? Is it signed or unsigned? The converter answers the first question. The surrounding code, file format, packet specification, or hardware manual answers the second and third.

What about fractional values?

This converter focuses on integer conversion because most everyday base tasks involve whole-number values: bytes, addresses, permissions, masks, character codes, and color channels. Fractional conversion is possible, but it uses a different process after the radix point. The integer part is converted by repeated division. The fractional part is converted by repeated multiplication by the target base.

For example, to convert \(0.625_{10}\) to binary, multiply by \(2\): \(0.625\times2=1.25\), so the first binary fractional digit is \(1\). Keep the fractional part \(0.25\). Multiply again: \(0.25\times2=0.5\), so the next digit is \(0\). Keep \(0.5\). Multiply again: \(0.5\times2=1.0\), so the next digit is \(1\), and the fractional part is now \(0\). Therefore \(0.625_{10}=0.101_2\).

Not every decimal fraction has a finite binary representation. The decimal fraction \(0.1_{10}\) repeats in binary, just as \(1/3\) repeats in decimal. This is one reason floating-point arithmetic can produce results such as \(0.1+0.2=0.30000000000000004\) in many programming languages. The issue is not that the computer is doing arithmetic casually; it is that finite binary floating-point cannot represent every decimal fraction exactly.

Fractional base conversion also requires decisions about precision, rounding, and repeating patterns. A general integer converter can give exact results for large whole numbers, while a fractional converter must decide how many digits to display. Because programming, networking, permissions, colors, and encoding tasks are usually integer-based, this page keeps the main tool focused on exact integer conversion.

Debugging and real-world workflows

When a programmer reads a hex dump, the values are usually displayed as bytes. A line might show 48 65 6C 6C 6F. Each pair is a byte in hexadecimal. Converting those bytes to decimal gives \(72,101,108,108,111\). In ASCII, those codes spell Hello. This is a practical example of how hexadecimal, decimal, binary, and text encodings connect.

When a web developer checks a color, the workflow is similar. The color #FF5733 splits into \(FF\), \(57\), and \(33\). The red channel \(FF_{16}\) is \(255_{10}\). The green channel \(57_{16}\) is \(87_{10}\). The blue channel \(33_{16}\) is \(51_{10}\). The value becomes RGB\((255,87,51)\). If a design tool gives decimal RGB but CSS needs hex, the workflow goes in the opposite direction.

When a system administrator reviews permissions, the visible value may be octal. The command chmod 700 gives the owner all three permissions and gives group and others none. In binary, \(700_8=111\,000\,000_2\). The first group means read, write, execute for the owner; the other two groups mean no permissions. The octal notation is compact because one digit matches one permission group.

When an embedded systems developer reads a register value, the data sheet may describe individual bits. A register value of 0xA5 becomes \(1010\,0101_2\). That makes it easy to see which flags are set: bits \(7\), \(5\), \(2\), and \(0\) are \(1\). Hex is compact for the register value, while binary is better for inspecting individual flags.

When a network engineer reads an IPv6 address, hexadecimal keeps a very long binary value manageable. An IPv6 address contains \(128\) bits. Written entirely in binary, it would be difficult for humans to read and compare. Hexadecimal compresses every four bits into one digit, so the address can be written in eight groups of four hex digits. This is still long, but it is usable.

When a cybersecurity analyst inspects signatures, hashes, or packet bytes, hexadecimal is again the normal display format. A SHA digest, file signature, or packet field may be shown as a long hex string. Converting selected bytes to binary can reveal flags and bit fields. Converting selected bytes to decimal can reveal lengths, ports, character codes, or numeric identifiers. The right base depends on the question being asked.

Classroom and exam strategy

For school and exam settings, show the method, not only the answer. If asked to convert decimal to binary, write the repeated divisions and remainders. If asked to convert binary to decimal, write the powers of two and the sum. If asked to convert binary to hex, show the four-bit grouping. A correct final value is important, but visible reasoning makes the answer easier to award and easier to check.

Use subscripts in written work whenever there is any chance of ambiguity. Write \(1010_2=10_{10}\), not simply \(1010=10\). Without the base labels, the statement is false in ordinary decimal reading. If subscripts are not available, use words: binary 1010 equals decimal 10. Clear notation prevents many simple mistakes.

Practice in both directions. Many students can convert binary to decimal but hesitate when converting decimal to binary. Others can use division but forget the direct grouping shortcut for hex. A balanced practice routine should include decimal to binary, binary to decimal, decimal to hex, hex to decimal, binary to hex, hex to binary, binary to octal, and octal to binary.

Use estimation to catch errors. If a binary number has eight bits and starts with \(1\), its value is at least \(128\). If you convert \(10010110_2\) and get \(38\), you know something is wrong because the leading bit alone is worth \(128\). If a two-digit hex byte is greater than \(FF\), it is not a byte. If an octal digit contains \(9\), the input is invalid.

For multi-step problems, decide whether decimal is actually necessary. Binary to hex does not need decimal. Octal to binary does not need decimal. Hex to octal can be done through binary: expand hex into four-bit groups, then regroup into three-bit groups. Decimal is useful for arithmetic interpretation, but it is not always the shortest route.

Finally, write leading zeros intentionally. If you are converting a byte, show eight bits. If you are converting a nibble, show four bits. If you are converting a permission digit, show three bits. Leading zeros may be mathematically optional, but they communicate width, and width is often part of the problem.

Troubleshooting pasted values

If a conversion does not work, first check the selected input box. A value such as FF belongs in the hexadecimal box, not the decimal box. A value such as 377 could be decimal or octal depending on context, so choose the box that matches the intended base. The converter intentionally treats each field according to its label.

Next, check for invalid characters. Binary accepts only \(0\) and \(1\). Octal accepts only \(0\) through \(7\). Decimal accepts only \(0\) through \(9\). Hexadecimal accepts \(0\) through \(9\) and \(A\) through \(F\). If you paste a value with a colon, dash, comma, percent sign, or hash symbol, remove the formatting unless the task specifically requires a different type of converter.

For color values, remove the leading # if you are converting a raw hex integer. For example, enter FF5733, not #FF5733, in the hex field. If you need channel-by-channel color conversion, use a color-specific tool because it will split the value into red, green, and blue components. A raw base converter treats the entire string as one integer.

For MAC addresses, remove colons before converting the full value, or convert each byte pair separately. The address 00:1A:2B:3C:4D:5E contains six hex bytes. If you paste the full address with colons into a pure hex field, the colons are invalid. If your goal is to understand the bytes, convert each pair or use a networking-specific workflow.

For binary values copied from notes, spaces and underscores are often used as visual separators. This converter ignores spaces and underscores, so 1111 0000 and 1111_0000 are treated as \(11110000_2\). Other separators should be removed. Keeping grouping clean makes long binary values easier to inspect without changing the value.

If the output looks shorter than expected, remember that the converter displays the minimal numeric representation. It may remove leading zeros because leading zeros do not change the value. If you need an \(8\)-bit, \(16\)-bit, \(32\)-bit, or \(64\)-bit display, add the leading zeros required by your context after confirming the value.

Use this page when you want all four integer bases at once. If you are working on a narrower task, a focused tool may be faster. For binary and octal work, RevisionTown has a binary to octal converter and an octal to binary converter. For octal and decimal, use the octal to decimal converter. For octal and hex, use the octal to hex converter or the hex to octal converter. For a broader directory of tools, RevisionTown's converters page is the best starting point.

If your task is not base conversion but general arithmetic, use a general math calculator or scientific calculator. If your task is computer science revision, the Cambridge IGCSE Computer Science 0478, Cambridge IGCSE 9-1 Computer Science 0984, and Computer Science 9608 resources provide course-specific context.

Practice questions

Try these without the converter first, then use the converter to check your answers.

Question 1

Convert \(42_{10}\) to binary.

Show answer

\(42=32+8+2\), so \(42_{10}=101010_2\).

Question 2

Convert \(101101_2\) to decimal.

Show answer

\(101101_2=1\times32+0\times16+1\times8+1\times4+0\times2+1=45_{10}\).

Question 3

Convert \(2F_{16}\) to decimal.

Show answer

\(2F_{16}=2\times16+15=47_{10}\).

Question 4

Convert \(11001100_2\) to hexadecimal.

Show answer

Group into four bits: \(1100\,1100_2\). Each group is \(C\), so the answer is \(CC_{16}\).

Question 5

Convert \(644_8\) to binary and explain its Unix permission meaning.

Show answer

\(6_8=110_2\), \(4_8=100_2\), and \(4_8=100_2\), so \(644_8=110\,100\,100_2\). In Unix permissions this means owner \(rw-\), group \(r--\), and others \(r--\).

Question 6

Convert \(ABC_{16}\) to decimal.

Show answer

\(ABC_{16}=10\times16^2+11\times16+12=2560+176+12=2748_{10}\).

Frequently asked questions

What is hexadecimal?

Hexadecimal is base \(16\). It uses the symbols \(0\) through \(9\) and \(A\) through \(F\). The letters represent values \(10\) through \(15\). Hexadecimal is widely used in computing because each hex digit maps exactly to four binary bits.

What is binary?

Binary is base \(2\). It uses only \(0\) and \(1\). Digital hardware naturally represents information using two states, so binary is the foundation of computer storage, logic, and processing.

What is octal used for?

Octal is base \(8\). It is less common than hexadecimal in modern programming, but it remains useful for Unix file permissions and for situations where binary is grouped into three-bit blocks.

Why does one hex digit equal four binary bits?

Because \(16=2^4\). Four bits can represent \(2^4=16\) possible patterns, from \(0000_2\) to \(1111_2\). Those patterns correspond exactly to hex digits \(0\) through \(F\).

Why does one octal digit equal three binary bits?

Because \(8=2^3\). Three bits can represent \(2^3=8\) possible patterns, from \(000_2\) to \(111_2\). Those patterns correspond exactly to octal digits \(0\) through \(7\).

What does 0x mean?

The prefix 0x marks a hexadecimal literal in many programming languages, including C, C++, JavaScript, Python, Java, Go, and Rust. For example, 0xFF means \(FF_{16}\), which equals \(255_{10}\).

Can the converter handle large values?

The converter uses integer parsing with BigInt when available, so it can handle large non-fractional values beyond ordinary floating-point limits. Extremely long pasted values may still be limited by browser performance and page memory.

Does this converter support fractions?

This converter is designed for integers. Fractional base conversion requires separate rules for digits after the radix point, such as multiplying the fractional part by the target base repeatedly. For most programming, permissions, byte, address, and color tasks, integer conversion is the required workflow.

Are leading zeros important?

Leading zeros do not change the numerical value, but they can matter in fixed-width computing contexts. For example, \(00001111_2\) and \(1111_2\) have the same value, but the first form shows an eight-bit field while the second does not.

Should I use decimal or hexadecimal when programming?

Use decimal when the value is a normal human quantity, such as a count or length. Use hexadecimal when the value represents bytes, bit patterns, memory addresses, colors, masks, registers, or data shown by debugging tools.

Final checklist

To convert into decimal, expand each digit using powers of the source base. To convert from decimal into another base, divide repeatedly by the target base and read the remainders upward. To convert between binary and hexadecimal, group binary digits in blocks of four. To convert between binary and octal, group binary digits in blocks of three. Always check that every digit is valid for the base, and remember that leading zeros can matter for fixed-width computer data even when they do not change the mathematical value.

For the most accurate workflow, identify the source base first, keep the original value visible while converting, label the result with its base, and verify the answer with either positional expansion or grouping. This habit prevents nearly all common mistakes with copied code values, homework answers, byte fields, color channels, and permission numbers.

Shares: