In programming, a magic number is a constant value used to identify a file format, protocol or error code. In many file formats, the first few bytes identify the file; for example, "PK" in ZIP files and the hex values "F8 D8" in JPEG files.
Certain communications protocols use a magic number, such as the hex values "63 82 53 63" at the start of every DHCP packet or "FF 53 4D 42" at the beginning of every SMB request. See DHCP
The term also refers to fixed values in a program that are never expected to change. For example, an algorithm involving playing cards might frequently use the magic constant "52" without jokers or "54" with jokers (or "51" and "53" for offset addresses).