A constant compiled into a computer program or
used in a file format for the purpose of being identifiably unique. A number which could only exist in memory on purpose and rarely by accident. For example, 0 is a bad choice for a magic number, since it's the default value for memory when a computer is turned on.
Programmers use them to quickly validate a larger data structure which could crash if it guesses the type wrong, using
the theory that whatever code put the magic number there probably got the rest of it right, since they would have made it store the magic number AFTER
everything else checked out.
Usually it's something easy for a
programmer to remember, like DEADBEEF or B00B135 or something equally assinine.
It's like a secret signal or whistle you might use with friends when trying to coordinate something sneaky.