Hex conversion covers two completely different jobs — colour values and raw bytes — and the mistakes are different in each. Work through this list and you will catch the ones that produce subtly wrong output rather than obvious errors.
Three-digit hex expands by duplicating each digit, not by zero-padding. #F0F is #FF00FF, not #F00F0F and definitely not #0F0F0F. Four-digit hex works the same way with alpha: #F0F8 becomes #FF00FF88. Any converter that pads instead of duplicating is wrong, and the error is invisible until someone compares against a design file.
#-prefixed and bare input; normalise to lowercase for comparison, since #AABBCC and #aabbcc are the same colour.80 is roughly 50% alpha, CC roughly 80%, FF opaque.parseInt(hex.slice(1,3), 16) per channel; convert back with value.toString(16).padStart(2, '0'). Forgetting the pad turns 10 into "a" and silently produces a five-character colour.color(display-p3 ...) or oklch().oklch() is now usable directly in CSS — and change lightness there.xxd -p file gives continuous hex, xxd file gives an offset-plus-ASCII dump, hexdump -C gives the canonical form most tools expect.xxd -r -p. If it produces garbage, check for whitespace and newlines in the input first.2a 00 00 00 on a little-endian dump and 00 00 00 2a on a big-endian one. Network protocols are big-endian; your laptop is not.0xFF is 255 or -1 depending on the type you decode into, and this is where checksum implementations usually go wrong.printf '%02x' 42 formats a single byte; od -An -tx1 is the portable alternative when xxd is missing.Round-trip everything: hex to value to hex must give the original string, modulo case. Test the boundaries — 00, FF, #000, #FFFFFFFF — and test invalid input explicitly, because a converter that returns NaN for #GGG and then renders it into CSS produces a page with no styling and no error.