twoodo
/

Home/Tools/Encoding & ciphers

Text to Hex Converter

Two hex digits per byte, which is why hex and bytes fit so well.

Why programmers count in sixteens

Hexadecimal uses sixteen digits — 0 to 9 then a to f. The reason it is everywhere in computing is a neat coincidence: one hex digit is exactly four bits, so two hex digits are exactly one byte.

That makes the mapping between hex and binary mechanical. Every byte is two characters, always, with no arithmetic required. Decimal has no such relationship: 255 is three digits and 256 is three digits, and neither aligns with anything.

Reading it

The first digit counts sixteens, the second counts ones. So 48 is (4 × 16) + 8 = 72, which is the letter H. And ff is (15 × 16) + 15 = 255, the largest value a byte holds — which is why #ffffff is white in CSS.

Landmarks worth recognising

  • 20 — a space
  • 0a — a line feed, the Unix newline
  • 0d 0a — carriage return plus line feed, the Windows newline
  • 41 to 5a — uppercase A to Z
  • 61 to 7a — lowercase a to z
  • 30 to 39 — the digits 0 to 9
  • ef bb bf — a UTF-8 byte order mark, the invisible character that breaks CSV imports

File signatures

Most file formats announce themselves in their first few bytes, which is how software identifies a file regardless of its extension:

  • ff d8 ff — JPEG
  • 89 50 4e 47 — PNG, where the 50 4e 47 spells "PNG"
  • 25 50 44 46 — PDF, spelling "%PDF"
  • 50 4b 03 04 — a ZIP archive, and therefore also .docx and .xlsx

If a file will not open, looking at its first bytes usually explains why faster than anything else.

Common uses

  • Reading a hex dump from a debugger or editor.
  • Identifying a file from its first bytes.
  • Puzzles and CTF challenges.
  • Checking an encoding issue byte by byte.

Questions people ask

Why do computers use hexadecimal?

Because one hex digit is exactly four bits, so two hex digits are exactly one byte. The mapping needs no arithmetic.

What is ff in decimal?

255, the largest value a single byte can hold. That is why #ffffff is white.

How do I read a hex byte?

First digit times sixteen, plus the second. 48 is (4 × 16) + 8 = 72, the letter H.

What are file signatures?

The first few bytes of a file, which identify its format. JPEG starts ff d8 ff, PNG starts 89 50 4e 47.

What is ef bb bf at the start of my file?

A UTF-8 byte order mark. It is invisible in a text editor and a common cause of broken CSV imports.

None of this is security

The ciphers on this site are historical. Every one of them was broken centuries ago, and a modern computer breaks them in microseconds — the Caesar page shows the break happening rather than just describing it.

They are worth knowing for puzzles, for teaching, for reading old texts and for understanding where cryptography came from. They are not worth using to protect anything. If you need something kept secret, you need modern encryption with a properly managed key, and you should not be building it yourself.

The encodings — Morse, binary, hex, NATO — make no secrecy claim at all. They exist to move information over a channel, and anyone can read them.

Your text stays in the page

Everything runs in your browser. Nothing you type is transmitted, logged or stored, and this site has no server that could receive it. The about page lists every request the site makes.