Common Hex Values Reference

How to Use This Page

This page is a working reference for the hex values you actually use day to day: the printable ASCII set, the most common control codes, the URL-encoding table, and the file signatures that show up in hex dumps. It is intentionally not exhaustive โ€” for that, the official Unicode code charts and the IANA registry of file signatures are linked at the bottom. Everything here is the subset we reach for ourselves.

If you find yourself coming back to this page more than once a week, the tables below are small enough to internalise entirely. After that, you will not need to look anything up.

Printable ASCII (0x20โ€“0x7E)

Printable ASCII covers 95 characters: space, the punctuation characters, the digits 0โ€“9, the uppercase alphabet, and the lowercase alphabet. Every character in this range fits in a single byte, and the high bit is zero.

CharDecHexCharDecHexCharDecHexCharDecHex
(sp)322004830@6440P8050
!332114931A6541Q8151
"342225032B6642R8252
#352335133C6743S8353
$362445234D6844T8454
%372555335E6945U8555
&382665436F7046V8656
'392775537G7147W8757
(402885638H7248X8858
)412995739I7349Y8959
*422A:583AJ744AZ905A
+432B;593BK754B[915B
,442C<603CL764C\925C
-452D=613DM774D]935D
.462E>623EN784E^945E
/472F?633FO794F_955F
`9660
a9761
b9862
c9963
d10064
e10165
f10266
g10367
h10468
i10569
j1066A
k1076B
l1086C
m1096D
n1106E
o1116F
p11270
q11371
r11472
s11573
t11674
u11775
v11876
w11977
x12078
y12179
z1227A
{1237B
|1247C
}1257D
~1267E

The remaining printable codes, 0x7F (delete) and everything below 0x20, are control characters. They are not printable, but they show up constantly in network protocols, log files, and binary formats.

Common Control Codes (0x00โ€“0x1F)

The first 32 ASCII codes are non-printable control characters. They were originally defined for controlling teleprinters, but a handful of them are still in active use today.

HexDecNameWhere it shows up
000NULC string terminator, null bytes in binary protocols
011SOHStart of heading, very rare outside legacy protocols
022STXStart of text, used in some serial protocols
033ETXEnd of text, Ctrl+C, common in framing protocols
044EOTEnd of transmission
055ENQEnquiry, very rare
066ACKAcknowledgement, used in serial comms and TLS
077BELTerminal bell, system beep
088BSBackspace, also used in regex word boundaries
099HT (TAB)Horizontal tab, \t in most languages
0A10LFLine feed, \n in Unix, second byte in Windows CRLF
0B11VTVertical tab, rare
0C12FFForm feed, page break in printer output
0D13CRCarriage return, \r, first byte in Windows CRLF
1B27ESCEscape, first byte of ANSI terminal control sequences

Two of these โ€” 0x0A (LF) and 0x0D (CR) โ€” are responsible for almost every "weird newline" bug you have ever seen. Unix uses LF only, classic Mac used CR only, and Windows uses CRLF (the pair 0x0D 0x0A). Most modern tools handle all three, but the bytes still show up in hex dumps and are worth recognising on sight.

File Signatures (Magic Numbers)

The first few bytes of a file identify its type. When you see an unfamiliar file in a hex dump, the magic number is almost always the fastest way to figure out what it is. The table below lists the magic numbers for the formats you are most likely to encounter on the modern web.

File typeFirst bytes (hex)ASCII shown
PNG image89 50 4E 47 0D 0A 1A 0Aโ€นPNGโ€บ
JPEG imageFF D8 FF(binary)
GIF image47 49 46 38GIF8
PDF document25 50 44 46 2D%PDF-
ZIP archive50 4B 03 04PK..
GZIP archive1F 8B(binary)
tar archive75 73 74 61 72ustar
ELF executable (Linux)7F 45 4C 46.ELF
Mach-O executable (macOS)CF FA ED FE(binary)
PE executable (Windows)4D 5AMZ
WebP image52 49 46 46 ?? ?? ?? ?? 57 45 42 50RIFF....WEBP
MP4 / MOV video00 00 00 ?? 66 74 79 70....ftyp
UTF-8 BOMEF BB BF(binary)
UTF-16 LE BOMFF FE(binary)

For the authoritative, comprehensive list, the IANA registry of media types and the file command's magic database (typically /usr/share/file/magic on Linux) are the canonical sources.

Common URL-Encoded Characters

URLs may only safely contain a subset of ASCII. Characters outside that set are percent-encoded, where the percent is followed by two hex digits giving the character's code point. The most common URL-encoded characters are shown below.

CharacterHexURL-encodedWhen you see it
(space)20%20Spaces in query strings, often + in form data
!21%21Rare; usually safe in URLs
"22%22Double quotes inside query values
#23%23Hash literal, must be encoded in query values
%25%25Literal percent sign
&26%26Ampersand in query values
'27%27Single quote
+2B%2BPlus sign, ambiguous in form-encoded data
/2F%2FSlash in path components
:3A%3AColon in path segments
=3D%3DEquals in query values
?3F%3FQuestion mark, separates path from query
@40%40At sign in user info
<3C%3CLess-than
>3E%3EGreater-than
\5C%5CBackslash, used in Windows paths
|7C%7CPipe, sometimes seen in URLs

A quick way to recognise percent-encoding in the wild: any time you see a % followed by two characters in the ranges 0โ€“9, Aโ€“F, or aโ€“f, that is a percent-encoded byte. Decode it by treating the two characters as a hex number.

Common CSS Colour Hex Codes

A short reference of the most-used CSS named colours and their hex equivalents. The full list of 147 named CSS colours is in the CSS Color Module Level 4 spec, linked at the bottom.

SwatchNameHexRGB
black#0000000, 0, 0
white#FFFFFF255, 255, 255
red#FF0000255, 0, 0
lime#00FF000, 255, 0
blue#0000FF0, 0, 255
yellow#FFFF00255, 255, 0
cyan / aqua#00FFFF0, 255, 255
magenta / fuchsia#FF00FF255, 0, 255
silver#C0C0C0192, 192, 192
gray#808080128, 128, 128
maroon#800000128, 0, 0
olive#808000128, 128, 0
green#0080000, 128, 0
purple#800080128, 0, 128
teal#0080800, 128, 128
navy#0000800, 0, 128
orange#FFA500255, 165, 0

For a deeper treatment of how hex colours are constructed and how to design accessible palettes around them, see the dedicated hex colours guide.

Reserved and Special Values

A handful of hex values come up so often in special contexts that they are worth knowing by themselves.

  • 0x00 โ€” the null byte. Marks the end of a C string and is a frequent source of bugs in fixed-width buffers (truncation at the first null, missing data after a null in a foreign format).
  • 0x0A and 0x0D โ€” LF and CR, the line-ending bytes. See the control codes table above.
  • 0xFF โ€” "all bits set" in an 8-bit value. Used as a sentinel value, a max sentinel, and a mask for the low byte of a 16-bit word.
  • 0xFFFF, 0xFFFFFFFF โ€” all bits set in 16 and 32 bits respectively. The "broadcast" address in IPv4 (255.255.255.255) is the decimal form of 0xFFFFFFFF.
  • 0x7F โ€” the delete control code, and also the high bit of a 7-bit ASCII value.
  • 0x80, 0x8000, 0x80000000 โ€” the sign bit set in 8, 16, and 32 bits. The smallest negative number in two's-complement signed types.
  • 0xDEADBEEF, 0xCAFEBABE โ€” sentinels used to mark uninitialised or special memory regions in many codebases. Recognise them on sight.

External References

When this page is not enough โ€” and it eventually will not be, because hex shows up in every domain โ€” these are the resources we reach for:

  • Unicode code charts โ€” the authoritative reference for every code point, including the full hex range above 0x7F.
  • CSS Color Module Level 4 โ€” the formal definition of every CSS named colour, including the 148 named colours in the basic and extended sets.
  • RFC 4648 โ€” the canonical spec for base16 (hex), base32, and base64 encoding.
  • RFC 3986 โ€” the URL syntax spec, which defines percent-encoding (Section 2.1) and the unreserved character set (Section 2.3).
  • The file command's magic database (typically /usr/share/file/magic on Linux) โ€” the comprehensive list of file signatures and their interpretations.

Decode a hex string, encode a file, or look up a value:

Open Hex Decoder โ†’