Recent chats
ASKGEEZ Q&A GUIDETechnology & devices

Why does the same byte value look different in binary, decimal, and hexadecimal?

Quick answer

Binary, decimal, and hexadecimal are different notations for the same numeric value. For example, byte value 104 is decimal 104, binary 01101000, and hexadecimal 68 [S1]. The digits look different because each base uses different place values. A leading zero pads the binary display to eight digits; it does not change the value.

LET’S WORK THROUGH IT

The question, the details, the next step.

Question

Why can I see one byte written as 104, 01101000, or 68? Are those different values?

Geez

They are three notations for the same numeric value, not three different values. In a Microsoft .NET Byte example, decimal 104 is shown as hexadecimal 68 and binary 1101000; adding a leading zero gives the eight-digit binary form 01101000 [S1].

Each notation uses a different base. Decimal uses powers of 10, binary uses powers of 2, and hexadecimal uses powers of 16. In 01101000, the place values from left to right are 128, 64, 32, 16, 8, 4, 2, and 1. The 1 digits mark 64, 32, and 8; together, those add to 104.

The written digits change, but the value they represent stays the same.

Follow-up question

Can you show the conversion, including how to check the hexadecimal value?

Geez

Here is one byte written three ways:

  • Binary: 01101000 = 64 + 32 + 8 = 104
  • Decimal: 104 = one hundred four
  • Hexadecimal: 68 = 6 × 16 + 8 = 104

The binary form uses eight digits to make the byte width visible; its first zero contributes nothing to the total. In hexadecimal, the 6 is in the sixteens place and the 8 is in the ones place. This conversion matches the .NET example [S1].

This shows equivalent notations; it does not mean every program displays bytes in all three formats by default. Formatting can determine which notation you see.

Follow-up question

Why do some binary examples have seven digits instead of eight, and does that mean the byte changed?

Geez

No. 1101000 and 01101000 have the same value: the first leaves out a leading zero, while the second shows it explicitly. The .NET example shows both forms for decimal 104 [S1].

Eight binary digits can make a byte-width display easy to count. A leading zero is padding in the written form, not a change to the numeric value. When comparing values, leading zeros do not affect the total; when checking how a byte is displayed, count the digits shown. Those are two different questions: “What number is this?” and “How many digits does this display include?”

Follow-up question

What quick method can I use when I encounter an unfamiliar byte value?

Geez

First identify the base from its label or context; the digits alone may not make that clear. Then convert it to a value you can check. For binary, add the place values wherever the digit is 1. For hexadecimal, multiply each digit by its place value, counting from the right in powers of 16. Compare the totals.

For this example, binary 01101000 gives 64 + 32 + 8 = 104; hexadecimal 68 gives 6 × 16 + 8 = 104; and decimal is 104 [S1]. These notations represent the same value. The cited example does not establish how a particular device, file viewer, or programming language will display a byte. If a display is unexpected, check that tool’s format or documentation.

A practical checklist

  • Identify whether the value is binary, decimal, or hexadecimal from its label or context.

  • For binary, add the place values corresponding to the 1 digits.

  • For hexadecimal, multiply each digit by its power-of-16 place value and add the results.

  • Treat leading zeros as formatting; preserve them when displayed byte width matters.

  • Compare the converted totals to check whether the notations represent the same value.

A few more useful answers

Does a leading zero change a binary number?

No. It does not change the numeric value, though it can make an eight-digit byte display clear.

Why is hexadecimal useful for looking at bytes?

It can write the same value more compactly than binary, as 68 does for binary 01101000. It is a different notation, not a different value [S1].

Does every programming language write hexadecimal and binary the same way?

No. Literal prefixes and formatting features can be language-specific. The cited examples describe .NET formatting and Visual Basic syntax, not every language [S1][S2].

Sources

References used for this guide.

  1. [S1] Byte Struct (System) — Microsoft Learn
    learn.microsoft.com · Checked
  2. [S2] Byte data type (Visual Basic) — Microsoft Learn
    learn.microsoft.com · Checked

YOUR QUESTION. YOUR DETAILS.

Let’s work through your situation.

Get a tailored answer or help with your next task. Starts at $1, with a quote before you pay.

Ask your own question
← Back to Geez at Work