belun.app Blog
RU

Text to Hex: How Hexadecimal Encoding Works and When You Need It

What hex bytes really are, how UTF-8 turns characters into hexadecimal, and the everyday places you'll run into hex — from CSS colors to hex dumps.

Screen filled with hexadecimal code and data bytes, the raw form behind text-to-hex conversion

Hex is one of those things you use for years before anyone explains it. You’ve typed #ff5733 into a CSS file. You’ve seen a git commit that starts with a67cde0. Both are hexadecimal, and once the idea clicks, a lot of programming stops looking like arcane symbols. The Text to Hex Converter is the quickest way to see the connection between the text you read and the bytes underneath it.

Why base 16 exists

We count in base 10 because we have ten fingers. Computers count in base 2, because a wire is either on or off. Hexadecimal — base 16 — is the translator between the two.

The trick is that one hex digit maps exactly to four bits, and two hex digits make a full byte. A byte holds a value from 0 to 255, which is 00 to ff in hex. That clean mapping is the whole reason hex won out over decimal for low-level work: ff is friendlier to read and type than 11111111, and it lines up perfectly with how memory is organized.

Hex uses the digits 0–9, then borrows a–f for the values ten through fifteen. So a is 10, f is 15, 10 is sixteen (not ten), and ff is 255.

From characters to bytes

Here’s where encoding matters. The letter H has the code point 72. In hex that’s 48. The word “Hello” becomes:

  • H → 48
  • e → 65
  • l → 6c
  • l → 6c
  • o → 6f

So “Hello” is 48 65 6c 6c 6f. Plain English text stays one byte per character because ASCII fits inside a single byte.

Step outside ASCII and it gets more interesting. Our converter uses UTF-8, the encoding that runs most of the modern web. In UTF-8, characters beyond the basic set take more than one byte:

  • éc3 a9
  • e2 82 ac
  • the Cyrillic Жd0 96
  • most emoji → four bytes

This is exactly why a tweet with emoji can hit its character limit sooner than you’d expect. Under the hood, one emoji is often four bytes, not one.

Where you’ll actually meet hex

Hex isn’t an academic exercise. It shows up constantly:

  • Colors. #ff5733 is three bytes: red ff, green 57, blue 33. Max red, medium green, low blue — a warm orange.
  • Hex dumps. Tools like xxd and hexdump show a file’s raw bytes in hex so you can inspect binary formats or spot a stray byte.
  • Escape sequences. \x48 in a string literal, or %48 in a URL, is a byte written in hex.
  • Hashes and IDs. MD5, SHA-256, git commit hashes, and MAC addresses are all hex strings.
  • Debugging. When a file won’t parse, dumping it to hex often reveals an invisible byte-order mark or a 0d 0a line ending where you expected 0a.

That last one has cost me an hour more than once. A config file looked identical to a working one, but a hex dump showed a UTF-8 BOM — ef bb bf — sitting at the very start, quietly breaking the parser.

Encode, decode, and check your work

Paste text into the top field of the Text to Hex Converter to see its bytes, or drop hex into the bottom field to read it back. It handles spaces, colons, and 0x prefixes, counts characters against bytes so you can see multi-byte characters at a glance, and never sends a single byte to a server. Try your own name and watch it turn into numbers.

Try the tool

Text to Hex Converter →