
Code as speech is the legal and philosophical doctrine in the United States that computer source code and similar digital expressions are forms of speech protected by the First Amendment. The idea emerged prominently during the "crypto wars" in the 1990s, when the courts disputed the U.S. government's notion that encryption software constituted munitions, instead recognizing code's expressive function in cases such as Bernstein v. United States. Since then, debates over encryption, privacy tools, cryptocurrency, and 3D-printed gun files have continued to test the boundaries of how law treats code as a medium of expression and continues to be the subject of legal and scholarly debate.
In 1977, controversy arose over the application of U.S. export controls to academic research in cryptography, after a member of the National Security Agency sent a letter to the Institute of Electrical and Electronics Engineers (IEEE) warning that the presentation material at a Cornell cryptography conference might violate weapons export regulations. In the early 1990s, the U.S. government started to more actively enforce that strong encryption software was a munition under export regulations, meaning it could not legally be shared overseas without a license. This classification of encryption as munitions was strongly opposed by computer scientists as well as civil liberties, privacy advocates, and cypherpunks who argued that encryption algorithms were mathematical ideas and publishing source code should be protected as speech.
Activists printed cryptographic source code on T-shirts as a protest against U.S. encryption export restrictions. Adam Back's "Munitions T-shirt", for example, displayed a short implementation of RSA, intended to demonstrate the implications of treating encryption software as export-controlled munitions.
In the mid-1990s Bernstein v. United States, mathematician Daniel J. Bernstein challenged U.S. export controls that restricted him from publishing Snuffle, an encryption system he had developed. Bernstein argued that the regulations constituted an unconstitutional restriction on his ability to publish and discuss cryptographic research. Bernstein was represented by the Electronic Frontier Foundation (EFF), which has since played a major role in digital free speech litigation.
The federal district court held that Bernstein's encryption source code constituted speech protected by the First Amendment, reasoning that, "Like music and mathematical equations, computer language is just that, language, and it communicates information either to a computer or to those who can read it." In 1999, a three-judge panel of the Ninth Circuit affirmed the judgment, concluding that encryption source code could constitute expression protected by the First Amendment. The Ninth Circuit subsequently granted rehearing en banc and withdrew the panel opinion.
Although the Ninth Circuit opinion in Bernstein was withdrawn, the case became an important part of the legal debate over whether computer source code constitutes speech protected by the First Amendment.
In 2016, the FBI sought to compel Apple to create special software to bypass security on an iPhone used by the San Bernardino shooter. Apple refused, arguing that the code itself is expressive and compelling software engineers to write it would violate the First Amendment's ban on compelled speech. The dispute ended in March 2016 after the FBI, with assistance from a third party, accessed the iPhone without Apple's help, and the government withdrew its request. As a result, the court did not rule on Apple's argument that compelling it to write and digitally sign the software would constitute compelled speech in violation of the First Amendment.

In the 2010s and 2020s, debate began to ensue about whether Bitcoin constituted code protected as speech. Proponents argue that Bitcoin's source code and protocol are themselves political statements about decentralization, censorship resistance, and distrust of centralized authority. Some legal scholars and activists argue that publishing or running Bitcoin software is inherently protected speech because it expresses economic and ideological beliefs and because it is code.
In the 2020s, U.S. authorities began to target developers of open-source privacy tools that interface with blockchains. In 2022, the U.S. Treasury sanctioned Tornado Cash, an Ethereum mixing protocol. Critics of this sanction argued that this constituted a sanction of the code rather than the criminal use. The EFF also defended the Tornado Cash developers arguing that publishing open-source privacy tools is protected expression. The prosecution of Tornado Cash founder Roman Storm, while sometimes framed as part of the war on crypto ended in August 2025, when Storm was convicted following a four-week jury trial of conspiracy to operate an unlicensed money transmitting business. The jury found that he knowingly operated Tornado Cash while it transmitted criminal proceeds; the offense carries a maximum sentence of five years' imprisonment.
In 2024, Keonne Rodriguez and William Lonergan Hill, the developers of Samourai Wallet, a Bitcoin privacy tool that uses CoinJoin to mix transactions, were indicted. Critics of the prosecution argued that the government was using efforts to combat criminal activity as a justification to target privacy software and code as speech. In July 2025, Rodriguez and Hill each pleaded guilty to one count of conspiracy to operate a money transmitting business knowing that it transmitted criminal proceeds. As part of their plea agreements, they agreed to forfeit approximately $238 million.

In 2013, Cody Wilson and his group Defense Distributed published the CAD files for the Liberator, a 3D-printable gun. The U.S. State Department ordered Wilson to remove the files over possible violations of arms-export regulations, triggering a legal dispute in which Defense Distributed argued that distributing the files was protected by the First Amendment.
Wilson also developed the Ghost Gunner, a small CNC milling machine that can finish metal gun parts. Defense Distributed portrayed restrictions on distributing digital gun-design files as a free-speech issue, arguing that such files were protected expression. Supporters argued that publishing design files, similar to publishing encryption algorithms, is expressive conduct. In 2018, Defense Distributed brought a separate lawsuit challenging efforts by New Jersey to prevent it from distributing files for 3D-printed guns to residents of the state. In February 2026, the Third Circuit Court of Appeals upheld the dismissal of the lawsuit. The court held that computer code can receive First Amendment protection but that not all code is necessarily protected: purely functional code without an expressive use does not fall within the First Amendment's protection. The court did not determine that Defense Distributed's gun files were themselves unprotected speech, finding instead that the plaintiffs had provided insufficient information about the files and their use to establish that the First Amendment applied.

In 2007, a 128-bit Advanced Access Content System (AACS) processing key, represented by the hexadecimal number 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0, was published on the Internet. The key could be used to decrypt HD DVD and Blu-ray content protected by AACS.
After the licensing organization AACS LA sent Digital Millennium Copyright Act (DMCA) takedown notices seeking removal of the key, it spread widely across the Internet, including on the social-news website Digg. Digg initially attempted to remove submissions containing the key, but users responded by repeatedly reposting it. After the resulting user revolt, Digg reversed its policy and announced that it would no longer delete stories or comments containing the number. One Digg user described the episode as a "digital Boston Tea Party".
The controversy also produced the Free Speech Flag, designed by John Marcotte, whose RGB color values encode the key. The flag was created as a protest against attempts to suppress publication of the number and illustrated the free-speech questions raised when information capable of circumventing technological restrictions is represented in expressive forms.
The AACS controversy impacted debates over the relationship between copyright, DRM, and freedom of speech. Similar First Amendment questions have arisen over the DMCA's prohibition on circumventing technological protection measures and distributing technologies that facilitate circumvention. The Electronic Frontier Foundation has argued that the DMCA's anti-circumvention provisions can unconstitutionally restrict speech when applied to the publication of computer code.
In 2015, UN Special Rapporteur on freedom of opinion and expression David Kaye concluded that encryption and anonymity enable individuals to exercise their rights to freedom of opinion and expression and therefore deserve strong protection.
{{citation}}: CS1 maint: location missing publisher (link)