An illegal number is a number that represents information which is illegal to possess, utter, propagate, or otherwise transmit in some legal jurisdiction. Any piece of digital information is representable as a number; consequently, if communicating a specific set of information is illegal in some way, then the number may be illegal as well.
 A number may represent some type of classified information or trade secret, legal to possess only by certain authorized persons. An AACS encryption key (09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0) that came to prominence in May 2007 is an example of a number claimed to be a secret, and whose publication or inappropriate possession is claimed to be illegal in the United States. It allegedly assists in the decryption of any HD DVD or Blu-ray Disc released before this date. The issuers of a series of cease-and-desist letters claim that the key itself is therefore a copyright circumvention device, and that publishing the key violates Title 1 of the US Digital Millennium Copyright Act.
 
In part of the DeCSS court order and in the AACS legal notices, the claimed protection for these numbers is based on their mere possession and the value or potential use of the numbers. This makes their status and legal issues surrounding their distribution quite distinct from that of copyright infringement. Any image file or an executable program can be regarded as simply a very large binary number. In certain jurisdictions, there are images that are illegal to possess, due to obscenity or secrecy/classified status, so the corresponding numbers could be illegal.
 In 2011 Sony sued George Hotz and members of fail0verflow for jailbreaking the PlayStation 3. Part of the lawsuit complaint was that they had published PS3 keys. Sony also threatened to sue anyone who distributed the keys. Sony later accidentally retweeted an older dongle key through its fictional Kevin Butler character.
 As a protest of the DeCSS case, many people created "steganographic" versions of the illegal information (i.e. hiding them in some form in flags etc.). Dave Touretzky of Carnegie Mellon University created a "Gallery of DeCSS descramblers". In the AACS encryption key controversy, a "free speech flag" was created. Some illegal numbers are so short that a simple flag (shown in the image) could be created by using triples of components as describing red-green-blue colors. The argument is that if short numbers can be made illegal, then any representation of those numbers also becomes illegal, like simple patterns of colors, etc.
 In the Sony Computer Entertainment v. Hotz case, many bloggers (including one at Yale Law School) made a "new free speech flag" in homage to the AACS free speech flag. Most of these were based on the "dongle key" rather than the keys Hotz actually released. Several users of other websites posted similar flags.
 An illegal prime is an illegal number which is also prime. One of the earliest illegal prime numbers was generated in March 2001 by Phil Carmody. Its binary representation corresponds to a compressed version of the C source code of a computer program implementing the DeCSS decryption algorithm, which can be used by a computer to circumvent a DVD's copy protection.
 Protests against the indictment of DeCSS author Jon Lech Johansen and legislation prohibiting publication of DeCSS code took many forms. One of them was the representation of the illegal code in a form that had an intrinsically archivable quality. Since the bits making up a computer program also represent a number, the plan was for the number to have some special property that would make it archivable and publishable (one method was to print it on a T-shirt). The primality of a number is a fundamental property of number theory and is therefore not dependent on legal definitions of any particular jurisdiction.
 The large prime database of the PrimePages website records the top 20 primes of various special forms; one of them is proof of primality using the elliptic curve primality proving (ECPP) algorithm. Thus, if the number were large enough and proved prime using ECPP, it would be published.
 There are other contexts in which smaller numbers have run afoul of laws or regulations, or drawn the attention of authorities.