Learn the Hexadecimal Number System

A practical guide to the hex number system: digits 0–9 and A–F, how hex compares with decimal, binary and octal, and when text-to-hex output is useful.

Hexadecimal, or hex, is a base-16 way of writing numbers. In text work it appears whenever characters are shown as their underlying values, such as in byte dumps, Unicode code points, escape sequences and color codes. This guide covers how hex counting works, how it relates to the other common bases, and whether converting text to hex suits a given task.

Is converting text to hex suitable for your use?

Hex is the right choice when you need to see exactly which characters or bytes a piece of text contains. It is useful for spotting invisible characters, telling look-alike letters apart, checking encoding problems and writing precise technical documentation. Its main benefit is that it is exact: every character maps to a specific, unambiguous value.

The tradeoff is that people cannot read hex output as language. Use plain text whenever the goal is communication, such as messages, posts, labels, alt text, or anything a person or screen reader is meant to understand. Hex also offers no secrecy. It is a reversible notation, not encryption, and anyone can decode it.

How the hex number system works

Decimal uses ten digits. Hex uses sixteen: 0 through 9, then the letters A through F for the values ten through fifteen. These six letters are often called the hex alphabet. Case does not change the value, so 2f and 2F mean the same number. Conventions differ on which case to use.

  • A = 10
  • B = 11
  • C = 12
  • D = 13
  • E = 14
  • F = 15

Each position is worth sixteen times the position to its right. The hex number 2F equals 2 × 16 + 15, which is 47 in decimal. After F comes 10, which in hex means sixteen. When the base is not clear from context, writers add a marker. Common markers are a 0x prefix in programming, U+ for Unicode code points, \x in many escape sequences, and # for web colors such as #FF8800.

Decimal, binary, octal and hexadecimal compared

Decimal | Binary | Octal | Hex
10 | 1010 | 12 | A
15 | 1111 | 17 | F
16 | 10000 | 20 | 10
65 | 1000001 | 101 | 41
200 | 11001000 | 310 | C8
255 | 11111111 | 377 | FF

Binary and hex are closely related. One hex digit represents exactly four binary digits (bits), so a byte of eight bits always fits in two hex digits, from 00 to FF. To convert, split the binary number into groups of four and replace each group with its hex digit. For example, 1100 1000 becomes C8. Hex is used for this reason: it is a compact and readable shorthand for binary. Octal groups bits in threes, which does not divide evenly into an 8-bit byte. That is one reason hex is now more common than octal for byte data.

To convert decimal to hex by hand, divide by 16 repeatedly and record the remainders. For 200, 200 ÷ 16 = 12 remainder 8. The quotient 12 is C and the remainder is 8, so the result is C8.

What a text-to-hex transformation actually changes

Converting text to hex replaces the stored characters with new characters. The output contains only digits, the letters A–F and separators, and these describe the original values. This is different from a visual effect such as a styled font, mirrored glyphs or a CSS presentation, where the underlying text stays the same. Hex output is not a reversal or mirror of the text, and it is not a font. It is a different representation of the same data.

There are two common forms, and they give different results for anything outside basic ASCII:

  • Code points: the Unicode number assigned to each character, written like U+00E9 for é.
  • Encoded bytes: the bytes produced by an encoding such as UTF-8, where the same é becomes C3 A9.
Text      UTF-8 bytes (hex)
Hello     48 65 6C 6C 6F
é         C3 A9            (single code point U+00E9)
é         65 CC 81         (e + combining acute U+0301)
👍        F0 9F 91 8D      (code point U+1F44D)

The two versions of é look identical on screen but have different hex values. This is often why converting to hex is useful: it reveals differences that plain display hides. It also means one visible character can take several bytes, and an emoji may span several code points. A tool that reports only one form, or does not state which encoding it uses, can produce output that does not match what another tool expects. Before relying on a converter's output, check which form and encoding it uses.

Avoid reversing or editing hex strings by hand. Reversing the byte order of UTF-8 output, or deleting a single digit, produces invalid or different text when decoded. Splitting a multi-byte sequence breaks characters such as é and 👍.

Will hex output stay usable after copying or sharing?

Hex output uses only basic ASCII characters, so it usually survives copy and paste, email and plain-text fields better than decorative Unicode does. The risks are mainly about meaning, not display:

  • Readability: readers see codes, not words, and need a decoder to understand the content.
  • Search: searching for the original word will not match its hex form.
  • Editing: changing the content means decoding, editing and re-encoding, and small typing errors corrupt the result.
  • Separators and case: some tools expect spaces between bytes, some expect none, and some require a prefix. Output that works in one tool may need reformatting for another.
  • Assistive technology: a screen reader will generally read hex as individual letters and numbers, not as the original text. No documentation or tests for specific screen readers were provided here, so check your target tool directly if this matters.

When hex appears in documentation or user-facing content, include the plain-text equivalent next to it, for example: 48 69 ("Hi"). This keeps the content understandable to readers, searchable and accessible, while preserving the exact values for technical readers.

Gaps in this guide

This guide describes how hex notation and UTF-8 encoding work. It does not evaluate any specific converter tool. No tests of particular apps, platforms or screen readers were available, and nothing is said here about how any tool handles or stores the text you paste into it.