How to use GNU licenses for your own software
This is a brief explanation of how to place a program under the GNU General Public License, Lesser General Public License, or Affero General Public License. For the GNU Free Documentation License, we have a separate page.
If you are looking for more detailed information, consider perusing our list of frequently asked questions about our licenses.
If you are considering using the GNU Lesser General Public License, please read the article “Why you shouldn't use the LGPL for your next library” first. The article explains why it may be better to use the ordinary GPL instead, and how we would make the decision.
Whichever license you plan to use, the process involves adding two elements to each source file of your program: a copyright notice (such as “Copyright 1999 Terry Jones”), and a statement of copying permission, saying that the program is distributed under the terms of the GNU General Public License (or the Lesser GPL).
The copyright notice should include the year in which you finished preparing the release (so if you finished it in 1998 but didn't post it until 1999, use 1998). You should add the proper year for each release; for example, “Copyright 1998, 1999 Terry Jones” if some versions were finished in 1998 and some were finished in 1999. If several people helped write the code, use all their names.
For software with several releases over multiple years, it's okay to use a range (“2008-2010”) instead of listing individual years (“2008, 2009, 2010”) if and only if every year in the range, inclusive, really is a “copyrightable” year that would be listed individually; and you make an explicit statement in your documentation about this usage.
Always use the English word “Copyright”; by international convention, this is used worldwide, even for material in other languages. The copyright symbol “©” can be included if you wish (and your character set supports it), but it's not necessary. There is no legal significance to using the three-character sequence “(C)”, although it does no harm.
You should also include a copy of the license itself somewhere in the distribution of your program. All programs, whether they are released under the GPL or LGPL, should include the text version of the GPL. In GNU programs the license is usually in a file called COPYING.
If you are releasing your program under the LGPL, you should also include the text version of the LGPL, usually in a file called COPYING.LESSER. Please note that, since the LGPL is a set of additional permissions on top of the GPL, it's important to include both licenses so users have all the materials they need to understand their rights.
If you are releasing your program under the GNU AGPL, you only need to include the text version of the GNU AGPL.
If you have copied code from other programs covered by the same license, copy their copyright notices too. Put all the copyright notices together, right near the top of each file.
It is very important for practical reasons to include contact information for how to reach you, perhaps in the README file, but this has nothing to do with the legal issues of applying the license.
The copying permission statement should come right after the copyright notices. For a one-file program, the statement (for the GPL) should look like this:
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
For programs that are more than one file, it is better to replace “this program” with the name of the program, and begin the statement with a line saying “This file is part of NAME”. For instance,
This file is part of Foobar. Foobar is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Foobar is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Foobar. If not, see <http://www.gnu.org/licenses/>.
This statement should go near the beginning of every source file, close to the copyright notices. When using the Lesser GPL, insert the word “Lesser” before “General” in all three places. When using the GNU AGPL, insert the word “Affero” before “General” in all three places.
For interactive programs, it is usually a good idea to make the program print out a brief notice about copyright and copying permission when it starts up. See the end of the GNU GPL for more information about this.
If you are releasing your program under the GNU AGPL, and it can interact with users over a network, the program should offer its source to those users in some way. For example, if your program is a web application, its interface could display a “Source” link that leads users to an archive of the code. The GNU AGPL is flexible enough that you can choose a method that's suitable for your specific program—see section 13 for details.
There is no legal requirement to register your copyright with anyone; simply distributing the program makes it copyrighted. However, it is a very good idea to register the copyright with the US Registry of Copyrights, because that puts you in a stronger position against anyone who violates the license in the US. Most other countries have no system of copyright registration.
It's wise to ask your employer or school, if any, to sign a copyright disclaimer for the work, so they cannot claim to hold it later. Below is a sample copyright disclaimer; just alter the names and program description as appropriate:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program “Gnomovision” (which makes passes at compilers) written by James Hacker.
<signature of Moe Ghoul>, 1 April 1989
Moe Ghoul, President of Vice
We would like to list all free software programs in the Free Software Directory, including all programs licensed under the GPL (any version). Please see the Directory web page for information and an online submission form.
It is also possible to make your program a GNU package, a part of the GNU Project. (That's if we like the program—we have to look at it first, and decide.) If you might be interested in joining up with the GNU Project in this way, please see our GNU software evaluation page for more information and a short questionnaire.
But you are welcome to use any of our licenses even if your program is not a GNU package; indeed, we hope you will. They're available to everyone. If you'd like to advertise your use of a particular license, feel free to use one of our logos.