How DNS encodes domain names: length-prefixed labels explained byte by byte

cneuralnetwork · x · 2026-10-22

Continuing his hand-rolled DNS resolver thread, @cneuralnetwork explains domain name encoding: names aren't sent as plain strings but as 06 google 03 com 00 — each label prefixed by its length byte, terminated by a zero.

A code screenshot shows the 12-byte DNS header followed by the question section with the encoded name, QTYPE=A and QCLASS=IN, as he constructs the query packet byte by byte.

Related event: Developer Builds a Mini DNS Resolver in C to Explain Domain Resolution(3 posts)→

Original post →

More from coding & agent

coding & agent channel →