I am a researcher, and in my research I do a lot of programming. I am a big fan of the open-source concept - especially in research, where transparency and reproducibility is already a big part of the culture. I gladly contribute as much as I can to the community, and releasing my code for anyone to use is part of that.

However, in research there is always a certain measure of uncertainty about what the stuff you produce will be used for. I fully understand that I can't copyright any results or conclusions - but I can protect how others use my code, and I would like to make sure that there is no (legal) way to incorporate software I produce in military applications.

I've read through a few of the shorter ones of the common OSS licenses, and summaries of some more, but they all seem to focus solely on the questions "do you earn money on my code?" and "do you make my code available with your program?" - nothing about what the program actually does with the code.

Are there any good open-source licenses that explicitly prohibit all kinds of military applications?


After reading up some more on how OSS works, I've realized that a license that meets my needs by definition will not be open-source, since open-source licenses cannot discriminate against fields. Thus, I'm rather looking for a license that is like an open-source license, except that it prohibits military use. I want this license to be already existing, authored or at least reviewed by someone who actually knows licensing, since I don't.

Also, in response to a couple of remarks that this will be difficult to enforce: yes, I realize that. But this is more for myself than for the legal implications; if I use a license like this, and a military organization uses my code anyway, they are breaking the law and they are doing it despite my explicit instructions not to. Thus, the potentially gruesome things that they do with applications that include software I've written are no longer "on my conciousness", since they stole the software from me. (And somewhere I have a naïve hope that if they need something I've done, and my license prohibits them from using it legally, they'll get someone elses program that does the same thing and allows them to use it. Not that governments always do, but they always should abide by the law...)

It's a moral safeguard, so to speak, rather than something I actually expect to bring up in court (if my mediocre code is ever used by CIA...)

  • 12
    Just so you know, any license that places restrictions on use will necessarily fail OSI or FSF approval, so you won't find any suitable licenses from those groups. Such a license won't be "open source" in the sense of "complies with the OSI's open source definition," though it may be "open source" in the more general sense of "having publicly-available source code."
    – apsillers
    Commented May 22, 2013 at 17:14
  • 4
    If it is a moral safeguard that you want then a simple license.txt with "This code may be freely used and distributed for any non-military purposes." should cover that. If you are looking for a sound legal footing then you need a lawyer and not the internet :D
    – Mike
    Commented May 22, 2013 at 17:50
  • 4
    @Mike In order to craft a new license, consulting a lawyer is required. However, there may be an existing license that has already been vetted by an outside organization that meets the desired criteria. Seeking that license is an appropriate question.
    – Thomas Owens
    Commented May 22, 2013 at 17:52
  • 33
    What exactly is "military use"? Would you allow use by a military organization (say, the US Army) in a humanitarian aid operation, or in a hospital? Would use by a non-military organization (say, IBM) supporting a military operation be okay? Could guerrilla forces use your stuff? Are intelligence agencies covered by your military restriction? Will your conscience be clear if a sweatshop boss (clearly non-military) uses your stuff to monitor his employees? And why do you think that you're responsible for what other people do with something you wrote and gave away, anyway?
    – Caleb
    Commented May 22, 2013 at 17:55
  • 12
    One more thing: if you do feel responsible for what other people do with your software, and if some army uses your software in the process of wreaking havoc on innocent people, is a tiny little line in your license that says "you can't do that" really going to make you feel any better? You've already acknowledged that you don't expect to enforce it...
    – Caleb
    Commented May 22, 2013 at 17:58

5 Answers 5


How would one enforce such a license?

Would you prohibit any military use? If the software checks air pressure in tires, and someone decides to use it on a military Hummer, is that a prohibited use? Can people in the military industrial complex use it to plan their monthly picnic?

Would it be an acceptable use if the software improved ballistic missile trajectories, and the improved accuracy of the weapon prevented civilians from being killed? Or would any use in a weapon be prohibited?

These are the kinds of questions you have to ask yourself, if you want to make a software license that satisfies your sensibilities.

Nevertheless, I'd try an keep it simple. Yahoo's Terms of Use state that their software must not be used

"to operate nuclear facilities, life support or other mission critical applications where human life or property may be at stake."

That's probably as good a clause as any, if you add the word "weapons" to the prohibited list of uses.

  • 3
    Yes, that is a good clause. However, would a nuclear power plant fall under "nuclear facilities"? If so, I might have to add "military" there - my research field is nuclear fusion... Commented May 22, 2013 at 18:22
  • 1
    It really depends on your motivations. Some people don't like nuclear power. Better military software can and does save lives (on both sides), because it makes more accurate weapons, but I doubt that you consider that an acceptable use. Commented May 22, 2013 at 18:25
  • 15
    Oh, and Yahoo adds the clause, not out of any moral obligation, but because software designed for life-critical applications requires a higher rigor by law, a rigor that Yahoo does not (and does not want to) comply with. Commented May 22, 2013 at 18:26
  • 1
    Generally, people looking for a license like this don't want their work contributing to killing people, in any way. So yes, not allowing it to be used for maintaining military vehicles would count. UN peace-keeping vehicles would be something you'd have to think about the wording of more carefully. On yahoo's license condition, that's usually there to absolve the company of responsibility, not explicitly to disallow a field. It's not strong enough, for my liking.
    – user51532
    Commented Dec 31, 2013 at 20:00
  • 2
    Exactly the same way the non-commercial clause is enforced. Your tire pressure example could have been a not for profit license source code being indirectly used for profit by a commercial air liner. Yes, it's messy but GNU GPL still survives so why shouldn't this? Commented Nov 24, 2020 at 15:02

I found this explicitly non-military license for an encryption algorithm called OCB.

2.1 License. Subject to your compliance with the terms of this license, including the restrictions set forth in Section 2.2, Licensor hereby grants to you a perpetual, worldwide, non-exclusive, non-transferable, non-sublicenseable, no-charge, royalty-free, irrevocable license to practice any invention claimed in the Licensed Patents (i) for any Research Use, (ii) for any Noncommercial Use, and (iii) in any Software Implementation.

2.2 Restrictions

2.2.1 The license above does not apply to and no license is granted for any Military Use of the Licensed Patents.

You ought to be able to modify it to refer to your own code, and be covered the way you want.

  • They also have a version of the license that doesn't have a military use exclusion. Not sure why they do that, but it's not uncommon for software manufacturers to have a "dual license" model so that users can pick the license that best suits them. Commented May 22, 2013 at 18:31
  • 1
    @RobertHarvey - Yeah, I was puzzled by that too. I think that there's the "Any use so long as it's open source", license, the "Any use so long as it's not military or commercial" license, and the "contact me" license. So an open source military project is fine, but a closed-source one is not.
    – Bobson
    Commented May 22, 2013 at 18:34
  • 2
    @Bobson - your edit makes your answer much more clear. Thanks!
    – user53019
    Commented May 22, 2013 at 18:37
  • 1
    @GlenH7 - Not a problem - it's definitely a valid point. Making any significant change without a lawyer is definitely a bad idea.
    – Bobson
    Commented May 22, 2013 at 18:39

Here's a starting point. It is Canadian Mind Products policy on "no military use" of their software. Canadian Mind Products is Roedy Green's company. Roedy has done some absolutely brilliant work, that has not gotten nearly enough mainstream attention.

Full Disclosure: 1. Roedy is an old friend, although we've never met in person. 2. I don't agree with him on this.

You might also look at Ben Kuipers "Why Don't I Take Military Funding?".

  • The CMP policy seems to have very much the same goals as mine. If I start receiving questions on why that clause is there in my license, I might refer them to read Roedy's explanation, since it pretty much sums up how I want my license to be interpreted. Commented May 23, 2013 at 11:53

I can't think of an example that has been tested in any court. The JSON license does state something that may be close to what you're looking for. Note that it's not considered open source because of that:

The Software shall be used for Good, not Evil.

There's nothing preventing you from adding your own statement to and MIT license, for example.

  • 7
    So who gets to decide what counts as Good and what counts as Evil? Commented May 22, 2013 at 17:31
  • 1
    Yeah, I've understood since writing the question that "Open Source" by definition does not discriminate against field, so maybe it's not an "open source" license I'm looking for. However, I'd like to use an existing license, without modifying it, because I don't trust myself to formulate an appendix that actually makes legal sense - it's much better if someone who knows licensing has already done that. Commented May 22, 2013 at 17:32
  • 4
    @FrustratedWithFormsDesigner - Google?
    – mouviciel
    Commented May 22, 2013 at 17:50
  • 5
    @mouviciel: Oh yeah, that will make me feel better. :/ Commented May 22, 2013 at 17:53
  • 9
    Have you seen wonko.com/post/jsmin-isnt-welcome-on-google-code? Half-way down the page is an excerpt from a talk by Crockford detailing IBM's legal woes when trying to use software under the JSON license. (It's funny.)
    – apsillers
    Commented May 22, 2013 at 18:27

Following the links on this page i found nothing up-to-date and available, neither the mentioned modified GPL nor the PeaceOSL. But you can read the latter here. And I wouldn't be sure how well defined the term any harm, which is their criteria, is in legal systems.

Maybe you want to contact the authors.

Not the answer you're looking for? Browse other questions tagged or ask your own question.