News: Lightbringer raises $10 million in Series A funding
September 4, 2026

Can I patent code I have already open-sourced?

You can patent the invention embodied in the code if you file within a jurisdiction's grace period, and you cannot patent it in a jurisdiction without one. Publishing source code on GitHub or under any public licence is a public disclosure of whatever the code enables. In the United States that starts the one-year clock under 35 U.S.C. 102(b)(1); in Europe it is prior art from the day the code became public, and Article 54 EPC gives no grace period. The patent covers the method or system, not the text of the code, so the question is whether the published code makes the claimed method available to a skilled person, which it usually does.

The licence you chose also matters. Apache 2.0 includes an express patent licence: every contributor grants users a perpetual, royalty-free licence to any patent claims necessarily infringed by their contribution, so you can still hold the patent but cannot assert it against users of that code. GPLv3 contains a similar patent grant in section 11. MIT and BSD say nothing express about patents, which leaves the position uncertain and is one reason enterprises are wary of them. What a patent still does for an open-source company is protect the method against competitors who reimplement it in their own proprietary code, and against uses outside the licensed contribution, which is why large open-source companies hold patent portfolios alongside their releases. If the code is not yet public, the order is the same as for a paper: file a first application, then push. Whether software is patentable at all is a separate question: see Software and AI patents.