Converters

Hex Converter

Convert hexadecimal to decimal and back, expand shorthand colour hex, and encode text as UTF-8 bytes. Shows why one hex digit is exactly four bits and where each notation is actually used.

Hex Converter

Results recalculate instantly on every keystroke. Nothing you type is transmitted.

Value
Text
Converted Value
One hex digit is exactly four bits, so two hex digits are always one byte. Case is not significant: FF and ff are the same value.
Decimal Equivalent
Bits and Bytes
Padded Forms
Read as a Colour
UTF-8 Bytes
Why Hexadecimal Exists
Where You Meet It

What this result does not account for

  • Whole non-negative values only. Signed and fixed-width representation belongs to the Binary Converter, where word size is an explicit input.
  • Integers above 9,007,199,254,740,991 are refused rather than silently rounded.
  • Text is encoded as UTF-8. Other encodings such as UTF-16 or Latin-1 produce different bytes for the same characters.
Zero-Server Execution Updated 11 Aug 2026 Reviewed by Sana Khalid IEEE-754 Double Precision

In short: Hexadecimal is base 16, so it uses the digits 0-9 then A-F, and one hex digit encodes exactly four bits. That is the whole reason the notation exists: a byte is always two hex characters, which makes memory dumps, colour codes and byte-level data readable at a glance.

Formula

value = Σ di × 16i

1 hex digit = 4 bits  ·  1 byte = 2 hex digits

[('di', 'the digit at position i, where A=10 through F=15'), ('i', 'position counted from the right, starting at zero'), ('16i', 'the place value, so FF = 15×16 + 15 = 255')]

Worked Example

  1. Strip any 0x or # prefix — both are conventions marking the text as hexadecimal, neither is part of the value.
  2. Read each digit as 0-9 then A=10, B=11, C=12, D=13, E=14, F=15. Case is not significant.
  3. Multiply each digit by 16 raised to its position from the right and add the results.
  4. To go the other way, divide repeatedly by 16 and read the remainders bottom to top.
  5. For text, encode each character as UTF-8 first, then print each byte as two hex digits.

FF is 15×16 + 15 = 255, which is why a single byte tops out there. The colour #FF8800 is therefore red 255, green 136, blue 0. Encoding the euro sign € as UTF-8 gives three bytes, E2 82 AC — which is why a text file of European prices is larger than its character count suggests.

Strengths & Limits Of This Model

Where this engine is strong

  • Shows bits, bytes and padded word forms alongside the value
  • Encodes real UTF-8 bytes, exposing the character-vs-byte gap
  • Expands shorthand colour hex correctly by doubling

Where it stops

  • Does not handle signed or fixed-width values
  • Does not compute contrast ratios — that is the Color Converter

Risk & accuracy notice. Treating a hex value as a quantity without knowing its word size is how sign errors enter production code. FF is 255 unsigned and −1 as a signed byte; the notation alone cannot tell you which.

Practical Use Cases

Reading a design file colour

Checking what RGB a hex code such as #FF8800 actually means before it reaches a stylesheet.

Inspecting a hex dump

Reading a byte offset or a memory address where the value is a bit pattern rather than a quantity.

Sizing a database column

Working out why a field sized in characters overflows when the data is stored as UTF-8 bytes.

Decoding an identifier

Reading a MAC address or a cryptographic hash by hand.

Resolving a Unicode escape

Turning an escape such as \u00e9 into the bytes that actually travel over the wire.

Methodology & Editorial Standards

Hexadecimal parsing and formatting use the platform's native radix routines at double precision, and the page declines any value above 9,007,199,254,740,991 rather than print an integer that can no longer be represented exactly. UTF-8 encoding is implemented from the code point directly following the standard one to four byte scheme, so the byte counts shown are the bytes that would actually be written to a file, not an estimate.

Computation runs in IEEE-754 double precision at full internal precision; rounding to two decimal places occurs strictly at the display layer, so no cumulative drift enters the result. All monetary outputs use accounting presentation — grouped thousands, two decimals, negatives in parentheses — so figures can be transcribed directly into a model or working paper. Division-by-zero and out-of-domain inputs return an em-dash rather than a misleading number.

This engine was reconciled against an independent reference implementation and hand-verified for the worked example above before release. Our full five-stage review process is published on the About Us page.

Sana Khalid Principal Front-End Engineer · ApexConverter

SI metrology and unit-system conversion accuracy. Last reviewed: 11 August 2026.

Disclaimer. This calculator is provided for informational and modelling purposes only and does not constitute financial, tax, legal, medical, or engineering advice. Verify all figures with a qualified professional before acting on them.


Hex Converter — 10 Expert FAQs

10 analyst-written answers to the questions practitioners actually ask — optimised for voice and answer-engine retrieval.

Why does hexadecimal use letters?

Because base 16 needs sixteen distinct symbols and the decimal digits only supply ten. A to F fill positions 10 through 15. The choice of letters is arbitrary convention, but it is universal: no system uses G or beyond for hex, and anything past F belongs to a higher base, which the Base Converter handles.

Is 0x part of the number?

No. 0x is a prefix that tells a compiler or a reader that what follows is hexadecimal, exactly as # does in a colour code. 0xFF, #FF and FF are all the value 255. This page accepts and silently strips both.

Does capitalisation matter in hex?

Not to the value. FF, ff and Ff are identical. It matters only to style guides: colour codes are conventionally lower case in CSS, while memory dumps and hashes are usually upper case. This page normalises to upper case for readability.

Why is one hex digit exactly four bits?

Because 16 = 2⁴. A single hex digit covers the sixteen values 0 to 15, which is precisely what four bits express. That clean alignment is the entire reason the notation won: two hex digits are always one byte, eight are always a 32-bit word, and no arithmetic is needed to see where a byte boundary falls.

What is the difference between this and the Base Converter?

The Base Converter handles any radix from 2 to 36 and explains fractional expansion. This page is about hexadecimal specifically — why it exists, how it maps to bytes, how it reads as a colour, and how text becomes bytes. If you want base 7 or base 36, use the Base Converter. If you want word size and signed values, use the Binary Converter.

How many bytes is my text?

It depends entirely on the characters. Under UTF-8, plain English is one byte per character, accented Latin letters are two, most Asian scripts and symbols such as € are three, and emoji are four. Type into the text box and this page counts both, because the gap between character count and byte count is the single most common cause of unexpected database truncation.

Why does one emoji count as two characters in some tools?

Because JavaScript, Java and Windows measure strings in UTF-16 code units, and an emoji needs two of them — a surrogate pair. The same emoji is four bytes in UTF-8. So one emoji can be reported as 1 character, 2 units or 4 bytes depending on who is counting, and all three answers are correct in their own frame.

Can hexadecimal represent a negative number?

Not on its own. FF is 255 or −1 depending entirely on the word size and whether the value is signed — and hex alone states neither. That is why this page declines negative input and points to the Binary Converter, where word size and sign convention are explicit inputs rather than assumptions.

What does #ABC mean in CSS?

It is shorthand for #AABBCC: each digit is doubled, not padded with a zero. This trips people up regularly, because #ABC looks like it should be a small number. The shorthand exists only because doubling gives an even spread of the 4,096 shorthand colours across the full 16.7 million.

Why do colour codes have six digits?

Three channels of one byte each: red, green, blue, two hex digits per channel. Six digits therefore describe 256³ = 16,777,216 colours. An eight-digit code adds a fourth byte for alpha transparency.

Related Converters Engines