I've spent some time reading the common copyleft and permissive software licenses. Is there a license which allows the creator of an application or algorithm to broadly specify who may use/distribute the product based on their own personal prejudices?

I understand that people use dual licenses to force commercial entities to pay for the permissive license or be forced to distribute sourse code for their projects, but I was thinking something more along the lines of, for example, "This code can be freely used, modified, and distributed by any entity not involved in Industry x [which I have deemed unworthy of the use of my free software]".

I have been unable to find any such licenses or license templates, and I would have thought that at least some programmers would be concerned about the ethical implications of their products. Is it possible to create an AI pathfinding algorithm and ensure it would not end up guiding an armed drone, or an Arctic ice floe model and ensure it would not end up being used for offshore oil drilling, while still using a permissive-style license?

  • 42
    The fundamental problem is coming up with a workable legal definition of what is and isn't "ethical"; if anyone could do that we wouldn't need 99% of our laws. Even "involved in X" is probably far too vague in practice. The JSON license famously said "The software shall be used for good, not evil" but nobody has a clue what that actually excludes, if anything. In practice the only feasible way to enforce your own ethical standards is to require all potential users of your software to get explicit permission to use it from you by explaining what they want to do with it.
    – Ixrec
    Commented May 24, 2016 at 6:43
  • 4
    The simple answer to the question in your last paragraph is: "Yes, don't give it to anyone to use"
    – Caleth
    Commented May 24, 2016 at 11:03
  • 4
    This is perfectly legal AFAIK in theory. The practical aspects are another story. You are going to need a good lawyer to properly phrase and define "any entity involved in Industry X". As someone who negotiates corporate contracts, I see phrases like this all the time in anti-compete clauses, and we strike them all the time because they are too vague, broad and/or subjective. Then there's the matter of enforcement: legal clauses that are not actively enforced by the owning party are problematic to say the least and in many cases they're held null and void. Commented May 24, 2016 at 13:27
  • 11
    Notable example: Treefinder's licence: treefinder.de Be warned, he comes off a bit kooky. Commented May 24, 2016 at 14:08
  • 15
    Treefinder's license is a cautionary tale. He basically says he can change your license terms any time he wants, which makes the software unsuitable for just about every use. Commented May 24, 2016 at 15:25

8 Answers 8


This question comes up fairly regularly in the free software community and this is understandable. People writing free software (often in their spare time) and donating it to the public normally do this because they want to make a difference for the better, not for the worse. So trying to ensure that your craft is not used in a way that you consider unethical is a natural thing to think about.

The Free Software Foundation clearly opposes attempts to use the software license to limit the ways people may use software, however. Richard Stallman wrote an article “Why programs must not limit the freedom to run them” where he explains why he is convinced that using software licenses to restrict usage of a piece of software to ethical applications is doomed to fail and would only hurt interoperability and limit the usefulness for legitimate users. I find his article very convincing and recommend of course that you read the original but I'm paraphrasing (with comments of mine) what I think are his main arguments here.

  • Disallowing the software to be used for illegal activities is pointless at best. Those activities are always illegal, no matter what the license says. A license can only grant the users of the software rights that the copyright holder has. It is not written explicitly in his article but I conclude and agree that it would make more sense to campaign politically that immoral activities be made illegal instead.

  • Disallowing the software to be used by states for immoral activities (RMS mentions torture as an example) is likely not going to be effective because most states have special legislation that allows them to do pretty much whatever they like as long as it is in the interest of national security. While I believe that this is somewhat exaggerated, it is certainly true that such legal exemptions for military usage exist in many states or could be passed should the legislative powers consider them desirable. What is probably more relevant is that you would have a hard time proving that your work is used at all without access to classified information and while copyright law is stretched by many players to justify outrageous things, I'm not aware that “getting access to classified information so you can sue the state” is something copyright law grants you in any state of the world. You certainly won't succeed suing an autocratic foreign state that might use your software for the most horrible things.

  • It is not clear whether such restrictions would even be enforceable via copyright and if they would, whether that would be beneficial. I can only speak of Germany but I'm pretty confident that any such licensing terms would be void in German court proceedings. I think that this is a Good Thing. Copyright law is already too powerful in what other people can force onto you. The last thing we need is even more restrictions.

  • If software licenses would restrict the usage of the software to “ethical purposes”, a terrible mess would result and software would not be compatible. While this certainly might happen, I don't see why there couldn't emerge a de-facto standard “ethical public license” published by a credible organization and used by many projects as it is the case with the GPL today. What I do see is that in order for such a general license to be widely accepted and used, it would very likely have to boil down to define as unethical what has already been agreed upon as unethical and therefore prohibited by public legislation in democracies, so it would not provide much. More important, since no such license exists today, you'd have to roll your own which is always a bad idea.

  • Do you think there could be a license which grants rights to a subset of the population (or uses), and any software which incorporates it must grant rights to a smaller-or-equal subset of the population (or uses)? Commented May 25, 2016 at 6:40
  • 1
    @BugCatcherNakata That would be kind of the opposite of a free software license. You could certainly write that into a document but I don't believe that it would be an effective legal measure to prevent your software from being used in applications you disapprove of. It would certainly stop many honest people from using your work, though.
    – 5gon12eder
    Commented May 25, 2016 at 18:53
  • There is actually a much wider gap between what is commonly accepted as ethical and what is legal than most people realise. A simple example: if you go to the shops today, a large portion of the coffee and chocolate on the shelves involved slave labor.
    – ChrisJ
    Commented Aug 10, 2018 at 8:35
  • Prohibitions sometimes exist to disassociate from something undesirable, rather than making it impossible to do. (1) and (2) is more a matter of deincentivizing someone suing the developer as an accomplice to a crime/immoral act. Even if the license grants no legal shield in this case, it lowers the "legal pot shots" taken at the developer. This is similar to store signs that say they're not liable for accidents or theft in the parking lot. It's a legally irrelevant notice, but it is used to shut down an attempted lawsuit, thus statistically saving the store/developer the costs of a trial.
    – Flater
    Commented Aug 19, 2018 at 10:43

There exist software projects that use a license like this. However, these would not be considered free licenses by the OSI definition.

More importantly, the enforceability of these licenses has been strongly questioned every time I've seen them mentioned, and they have never, to the best of my knowledge, been tested in court. Using such a license is unlikely to have more than symbolic value.

Part of the problem here is that such terms are incredibly vague, as Ixrec points out in his comment. Let's say you develop an algorithm that guides self-driving cars. Ethical? Probably. Then this algorithm is used to build trucks that drive on their own. Still ethical. And now these trucks are used to resupply military camps, or transport drugs; will you then say that this isn't allowed because your code is used in there? Maybe they're even used in human trafficking, which is definitely unethical, but how would you control for that? Require the truck manufacturers to also put a license on their trucks?

Finally, your average military or oil company has enough money to just take your idea and reimplement it, so if it's your algorithm you don't want used, you're out of luck anyway. And since military code (such a rocket or drone guidance software) is usually classified anyway, how would you know that your code was used?

  • 1
    Re your last paragraph: you cannot patent algorithms in many parts of the world (e.g. Europe), and copyright doesn't protect the algorithm but only the actual code as written, so it only avoid people copy&pasting your code not people actually reimplementing the algorithm with different code.
    – Bakuriu
    Commented May 24, 2016 at 14:59
  • 6
    One famous is Douglas Crockford's JSON license: json.org/license.html "The Software shall be used for Good, not Evil".
    – Eterm
    Commented May 24, 2016 at 15:17
  • 8
    "Then this algorithm is used to build trucks that drive on their own. Still ethical." - Actually...if the self-driving trucks force human truck drivers out of work and into poverty as a side-effect, there's a case to be made that creating self-driving trucks is not ethical. So yes, it's an incredibly vague standard.
    – aroth
    Commented May 25, 2016 at 2:44
  • It's frustrating that JSLint is constantly held up as why ethical licenses are bad. It's like if someone wrote a law that said "don't be a criminal" and everyone was like "See, you cant use laws to stop criminal behaviour because you can't define criminal". You can, but only if you try ;-) Counterintuitively though, JSLint actually provides some strong evidence that such a license could work. Even though most people speculated that it was unenforcable, IBM still explicitly sought permission to use the software for evil before using it - the fear of possible enforcement was enough.
    – ChrisJ
    Commented Aug 10, 2018 at 8:43
  • @ChristopherJ What does your comment have to do with my answer? I didn't mention JSLint at all. Commented Aug 10, 2018 at 17:20

When you look at the current market, there are already licenses that have stipulations about what the software might be used for.

  • Apple has a stipulation in their iTunes license which says you're not allowed to use it to develop nuclear weapons.
  • the game Far Cry 2 has a stipulation in the license that you're not allowed to use it contrary to morality or laws in force.
  • WordWeb has a license which states you're not allowed to use the free version if you've taken more than 4 flights in the past 12 months OR own/regularly drive an SUV, although that last stipulation has an exemption for educational institutions and the registered disabled that require an SUV for transport..
  • Amazon AWS Lumberyard (a video game engine) has a license that restricts use of the software in various automation and military purposes, but with a stipulation that this restriction does not apply in the event of a zombie apocalypse. Here's how the license words it:

    [...] The occurrence (certified by the United States Centers for Disease Control or successor body) of a widespread viral infection transmitted via bites or contact with bodily fluids that causes human corpses to reanimate and seek to consume living human flesh, blood, brain or nerve tissue and is likely to result in the fall of organized civilization.

There are probably a number of other licenses that have similarly weird clauses. So a license that discriminates based on ethical grounds would not be the first time a license has a weird stipulation..

  • 4
    +1 for mentioning the "nuclear weapons". Mentioning nuclear plants or hospitals is also common, more to avoid responsibility if something goes wrong in such critical systems than for ethics, though. In the case of iTunes, it's a restriction of US law that it cannot be used for «the development, design, manufacture or production of nuclear, missiles, or chemical or biological weapons.» (wanna send missils with unbearable songs to your enemy? ☺).
    – Ángel
    Commented May 25, 2016 at 2:27
  • -1 for mentioning "nuclear weapons" because it's merely a restatement of existing controlling law. Commented May 25, 2016 at 8:14
  • 1
    @chrylis Even so, it's still part of the license agreement. I'll add a new one that's comparable in weirdness.
    – Nzall
    Commented May 25, 2016 at 9:12
  • Java license states that "You acknowledge that Licensed Software is not designed or intended for use in the design, construction, operation or maintenance of any nuclear facility" oracle.com/technetwork/java/javase/downloads/…
    – drolex
    Commented May 25, 2016 at 10:34
  • @Nzall did you get these licenses from a list? From memory? I'm looking for more resources on this topic. Thanks!
    – Maggie
    Commented Apr 5, 2018 at 21:10

You can write any license you like, and sue anyone who uses your code contrary to the terms of the license for copyright infringement.

Your terms "not to be used by industry X" makes the license incompatible with the GPL license, for example. I cannot include your software in GPL code that I want to distribute (or that may be distributed accidentally, which happens). I couldn't include your code in my company's closed source code, because the legal department would kill me (it means if someone offered us millions for our source code we might not be able to sell it due to your restrictions). At the very least our legal department would say "it will cost us $5,000 to check the license. How much does it cost you to write the code yourself?"


If you're concerned about the ethics of industry X, rather than creating a license that discriminates against industry X, you could approach it differently; you could go the dual license approach, and create a free and commercial version. Then make donations to some anti industry X organization - either in the form of a full commercial version or some cut of the profits from the commercial version.

This is completely legal, and it's supporting an ideal you believe in. Also it's much better "good will marketing". Even people in the pro industry X crowd will respect you because at least you're supporting something you believe in. It's always better to be seen supporting an ideal rather than attacking its counter ideal.


I work for a company with a mandate to develop software products for progressive charities. We created some libraries that we wanted to open source and, like the OP, we weren’t satisfied with the licenses that we could find.

We created the Just World License so that, at the very least, our code wouldn’t be used by those that are working against the goals of the charities we support. (Here’s an article explaining our reasons behind it)

Below I’ll address some of the objections to ethical licenses raised in comments and answers. In doing so I’m going to draw comparison to the GPL because it is also an example of a license that's drawn from a strong ideological viewpoint and so is instructive in how a license is more than just a legal document, and the aspects of it we’ve come to accept.

Why (not) ethical?

Many of the objections I've read are related to the enforceability of such a license, but I would argue that the purpose of an ethical license is not to enforce it in a court. In fact, most legal documents you really don't want to be testing in court - it's expensive and painful. Yes, you should make them clear and unambiguous, but most people don't draft legal documents with the primary goal being to take the other party to court.

As people have (rightly) pointed out, if a big company wants to use your software despite restrictions, they likely have the resources to bury you in legal paperwork.

But, this is no different from the GPL, and the GPL, too, wasn’t written so that FOSS developers could haul big companies to court for misusing open source code. Yes, it’s legally specific and possible to enforce, but that wasn’t the primary purpose the authors had in mind for it. They created the GPL to spread an idea - the idea that software and it’s source should be freely shared.

Likewise, in creating an ethical license, we want to spread an idea - that our software should be used for the betterment of the world, and that we as developers can take responsibility for how our software is used.


That being said, I would also argue that an ethical license can be enforced. Even with the extremely vague licensing terms of JSLint, IBM was sufficiently concerned about enforcement as to ask the author for express permission to use JSLint for evil.

Yes, big tobacco could use our code and keep quiet about it, but the fear of being discovered or whistle-blown and the possibility of enforcement is enough for most companies, even the ones doing bad things, to decide it’s not worth the risk and go and find some other code.

Restricting usage for illegal things is pointless


In writing an ethical license we decided not to exclude illegal acts for this reason, and also because some countries have really bad laws that restrict people’s freedoms in awful ways. If the activists working against those things want to use our software, they’ve got enough to worry about without worrying that we might show up and add a cease and desist to their troubles.

If it’s bad, there are laws to stop it

<insert obligatory video of lawmakers asking Mark Zuckerberg about sending an email over WhatsApp>

Our lawmakers are, unfortunately, among the slowest to move when it comes to responding to changing social norms, let alone technology. For starters, it’s 2018 and there are still products on shelves that are made by actual slaves.

Ethical cannot be defined

The world is not as grey as it’s often made out to be.

Our license would prevent people from using our software for (among other things) taking action that is known to ruin the state of the planet for future generations, exploiting slave labour, promoting racism, or hacking behavioural psychology to make people waste loads of their life clicking ads.

These aren’t exactly the trolley problem.

Ethics is subjective

Yes, but this isn't a bad thing.

Some of our most essential decisions are subjective. If you're interested, there's some really interesting stories of people who've had their emotional centres damaged in an accident and are no longer able to function even though their reason and objectivity is completely intact.

Less philosophically. The notion that it’s wrong to take FOSS software and improve it without releasing the changes is also a subjective position. This is a subjective viewpoint that forms a key part of the GPL and not everyone in the software development world can agree that it's a good thing, but this difference of opinion hasn't brought down the FOSS community yet ;-)

It would be inconvenient

Well, that’s kind of the point. If a company is writing software for ethically dubious acts, then an ethical license is meant to be an inconvenience.

The same could be said of some FOSS licenses. Some companies today are using tools like license checker because they don’t want GPL code in their products.

If every author threw in their own definition of ethics and we had loads of non-standard ethical licenses then this does become very arduous and inconvenient, but if, like we do now for general open source, we could agree on a handful of standard licenses there’s no reason it would be any less convenient.

Bad Companies will just write their own

Good. Let them waste their resources if they want to profit from harming people and our future.

I’m not going to kid myself that placing the small libraries I've released off limits is going to materially inhibit big evil corporations, but what if bigger projects did?

For example, Apache’s Hadoop is being used by oil and gas companies to help them operate more profitably at a time when they should be shutting their doors so we can avert a climate disaster.

If the Apache Foundation determined that such uses did not fall within the public benefit that their mission envisions for their resources and decided to codify that in their license, the companies would have to turn to something else, maybe an expensive proprietary solution. This drag on the bottom line of a company that harms our future would be a good thing.

It's a new idea

All this said, the Just World License is a new idea. We think it's got legs, and we’d welcome feedback or pull requests to make it better.


There are some licenses that specifically prohibit military usage.


"Open-source" licenses that explicitly prohibit military applications

The problem with those kinds of things, is they become incompatible with other licenses such as the GPL. So on the surface they might seam 'reasonable' but they can cripple the usage.

The CryEngine's license only allows for development of 'Games' and specifically forbids the following:

  • military projects
  • gambling;
  • simulation (technical, scientific, other);
  • science;
  • architecture;
  • pornography;
  • Serious Games.

Serious games:

1.10. “Serious Games”, i.e. ‘games’ which are not developed for the sole purpose of entertainment but for purposes training, simulation, science, architecture etc.

Of course that is likely for business reasons rather than for ethical ones since they could get more money out of a military contractor for example and they would just need to get a different license. Also kind of crappy that educational games aren't allowed.


Any license which restricts use of the software to certain purposes is by definition not a Free Software license. It is a violation of the very first of what GNU considers the four essential freedoms:

  • The freedom to run the program as you wish, for any purpose (freedom 0).

You can find several in GNU's list of non-free software licenses, but frankly the world is chock full of non-free software licensees. A good example is the JSON license, which includes this:

The Software shall be used for Good, not Evil.

Note that any such license is incompatible with GPL and the LGPL. That means if anyone tries to use software using that license with GPL or LPGL software, the resulting work may not be legally distributed to anyone.

In general, I really, really hate having to pore through someone's homebrew software license to see if I can use their software. I have better things to do with my time. I've found there are 3 licenses that can be used for any purpose I would ever publicly release software:

  • GPL - For software I don't ever want some company putting in their own closed-source product. I'm donating it for the public good, if you build on it then you should too (or keep it to yourself). You can still make money, you just can't close the sources.
  • GPL with linking and inclusion exceptions - For libraries and APIs that I want to keep open, but allow people to use in closed-source programs. This means anyone can use the API even in proprietary projects. Many people think the LGPL allows this, but it doesn't quite.
  • CC0 - I'm giving this away. Do whatever you want with it. This is the closest an American can legally get to Public Domain.

If you use something else, I'm already a little annoyed with you. If its obscure enough that it isn't on GNU's license list, so I have to analyze it myself, I'm triple annoyed. Usually its easier just to find some other software with a better license.

Note that anyone who is going to use your software for "evil" most likely won't care much about usage restrictions in your license either.

  • 12
    OP never stated he wanted this to be free software, did s/he? Commented May 24, 2016 at 14:07
  • 4
    This answers a question not stated. It should probably be posted elsewhere, not here.
    – Mast
    Commented May 24, 2016 at 14:17
  • 1
    @JamesMcLeod - "I've spent some time reading the common copyleft ....".
    – T.E.D.
    Commented May 24, 2016 at 15:54
  • 1
    I think that the MIT license covers an important mid-ground between (L)GPL (with exceptions) and CC0. It is also very well-known and widely used for software which will make potential users happy. Anyway, this is digressing from the question asked here.
    – 5gon12eder
    Commented May 24, 2016 at 20:01
  • 1
    I can imagine the frustration with 'homebrew' licenses. I had intended my question to cover 'free' software in the layperson definition of free. I think that avoiding homebrew licenses is a very good idea, and is part of my motivation in asking this question Commented May 25, 2016 at 6:34

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