When searching for "gpl javascript" in Google, I currently find these five first results:

  1. A piece by RMS warning about how we are using more and more web apps and that we should care whether these apps are free software as much as we care whether our "traditional" software are free software.

  2. A question on Stack Overflow (No 1239470) regarding the consequences of using a GPL'd library on one's website. Unfortunately this question was closed as off topic and all the answers which were given at that time are pretty bad. In particular, the first answer is horrible but it still has 13 upvotes (after my own downvote). This is pretty sad given that the question was viewed 12645 times. I am not linking to the question to avoid giving it more pagerank that it already has.

EDIT: Can I encourage anyone who has the privilege to downvote on SO to downvote this answer as well? I know I shouldn't be asking this, but I feel that it needs some action from people who know better. It is now the first result that appears when searching for "gpl javascript".

  1. A similar question on Programmers SE with a more reasonable answer.

  2. A short blog piece https://hroy.eu/posts/gpl-js-bs/ which explains clearly that using a single GPL'd component on a website does not require open sourcing the whole website. But if you build your web app on top of some GPL'd component then the whole web app should be GPL'd as well.

  3. A very good FAQ http://greendrake.info/content/nfy0, which is quite recent (Sep 2015) and which I recommend, anwsering most questions that people may have on using GPL'd client-side code.

Additionally, this site has a few questions on some of these aspects as well. Examples:

I feel that this site should have its own general question on the implications of licensing a JavaScript library under GPL, to dedramatize further, but also to clarify what is well understood so far and what is not.

So here is a list of sub-questions (some which are already addressed in the references I gave, some which are not):

  1. If I use a GPL'd component on my website, is the content of the website affected?

  2. If I use a GPL'd component on my website, is the design (CSS) of the website affected?

  3. If I use a GPL'd component on my website, are other JS components affected (if each of the component is loaded in a different <script> tag)?

  4. If I use a GPL'd component on my website, are other JS components affected (if all the components are loaded from the same main JS file)?

  5. If I build a web app and it uses a GPL'd component/library, does it mean that the full web app should be released under GPL (at least the client-side part of it)?

  6. Is the design (CSS) of the web app also affected then?

I am aware that not all of these sub-questions have necessarily a well-defined answer. Feel free to answer even only partially to the ones you feel comfortable answering.

  • Small hint on your further digging: Mozilla doesn't consider minified JS to be source code. According to this logic, if you use a minified library, you are not affected by GPL at all. – ZeroUnderscoreOu Aug 25 '16 at 8:54
  • 3
    @ZeroUnderscoreOu On the contrary, distributing a minified library would be like distributing a binary of the library, thus you should conform to the obligations which apply when distributing a binary of a GPL'd software: providing a way to get the source. – Zimm i48 Aug 25 '16 at 9:01
  • If such library is properly distributed, source code is already available, so that shouldn't be a problem. – ZeroUnderscoreOu Aug 25 '16 at 9:12
  • That's right. So the only remaining question is: is other code on the page considered a derivative work and thus affected or not? – Zimm i48 Aug 25 '16 at 9:13
  • I expanded my answer a bit to try and cover that question. It's not the only one as it's also the question if GNU follows the same view on minified JS. Also, you probably should edit the title, as it seems to ask about licensing your own JS under GPL and not using others'. – ZeroUnderscoreOu Aug 25 '16 at 10:04

About JS:

GPL JS exception

As a special exception to the GPL, any HTML file which merely makes function calls to this code, and for that purpose includes it by reference shall be deemed a separate work for copyright law purposes. In addition, the copyright holders of this code give you permission to combine this code with free software libraries that are released under the GNU LGPL. You may copy and distribute such a system following the terms of the GNU GPL for this code and the LGPL for the libraries. If you modify this code, you may extend this exception to your version of the code, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.

Thus, if I read this right, in case of presence of such a note it's a definitive no to points 1, 2 & 6. With 4 you'd probably have to release JS under LGPL. Absense of this note most likely means the opposite.

About combination:


By contrast, pipes, sockets and command-line arguments are communication mechanisms normally used between two separate programs. So when they are used for communication, the modules normally are separate programs. But if the semantics of the communication are intimate enough, exchanging complex internal data structures, that too could be a basis to consider the two parts as combined into a larger program.

According to this, JS libraries in most cases may be cosidered separate programs, not binding each other.

GPL linking & GPL libraries

Linking a GPL covered work statically or dynamically with other modules is making a combined work based on the GPL covered work.

GPL modules

But you can give additional permission for the use of your code. You can, if you wish, release your program under a license which is more lax than the GPL but compatible with the GPL. The license list page gives a partial list of GPL-compatible licenses.

This is contrary and would mean requirement to release under GPL-compatible license (in case of modules not necessary GPL itself).


It depends on how the program invokes its plug-ins.

This is just ambiguous.

So it really depends on what you consider JS to be and open to argument until GNU provides a specific point of view, but...

About minified/obfuscated JS:

The “source code” for a work means the preferred form of the work for making modifications to it.

This definition (barring the quotes) is the same both for GPL 2 & GPL 3, making GNU's stance the same as Mozilla's - minified/obfuscated JS (which is common for libraries) is not source code, thus you must follow only distribution requirements (in most cases - providing a link to a library's page you used yourself).

Note, that I'm not a GPL specialist and just quoted some of the FAQ. Someone with a better knowledge of the license may provide a better answer.

  • That would have been great news but in fact you are quoting a "special exception" which FSF suggests to add when distributing Javascript code under GPL. So it might imply that the absence of this exception might actually mean the opposite. – Zimm i48 Aug 25 '16 at 9:12
  • @Zimmi48 oh, you're right, I was hurrying to much. The last sentence probably means exactly the opposite in general case. Editing the answer. – ZeroUnderscoreOu Aug 25 '16 at 9:14
  • 1
    @Zimmi48 this is from the question about modules - quoted that now. – ZeroUnderscoreOu Aug 25 '16 at 11:21
  • 1
    I awarded the bounty to you to thank you for your research. Your answer gives some interesting indications. However the question would still benefit from a more complete answer if anyone has the necessary knowledge. – Zimm i48 Aug 31 '16 at 17:16
  • 1
    @Zimmi48 thank you. Actually, I have emailed to FSF with this question 2 days ago. If and when I'll get an answer from them, I'll update the answer & notify you. – ZeroUnderscoreOu Sep 1 '16 at 4:26

The following is the answer I got from FSF, with small edits. Answer was provided by a volunteer with "[this] is not legal advice" disclaimer.

  1. GPL-ed JS is used with other JS without cross calls.

If Javascript software licensed under the terms of the GNU GPL is served from the same document alongside an independent Javascript work is may be the case that the two would be considered in mere aggregation (see: http://www.gnu.org/licenses/gpl-faq.html#MereAggregation). Whether or not this is the case would be a matter of looking at particulars; it is impossible to provide you with a blanket statement that would cover all conceivable cases.

The terms of the GNU GPL require that the source code for an executable be made available in one of the ways the GPL permits. If the Javascript is minified or obfuscated the GPL would require that the corresponding source code be made available. This is also very useful in cases where multiple Javascript libraries are being served minified and concatenated into a single document.

FSF has written a guide to releasing your Javascript as free software, available here: https://www.gnu.org/software/librejs/free-your-javascript.html

  1. GPL-ed JS extends the DOM/core functionality; extended functionality is used, but no direct calls are made.

When the template code on the server and the Javascript are specifically designed for each other they may be considered mutually derivative works. The FAQ explains this situation.

  1. GPL-ed JS is called by other JS, from within HTML file or separate script; does the origin of calling JS makes difference?

The same rules apply in this situation as when one body of code makes a function call into another. Javascript is capable of making such calls as well as any other language. Whether or not they would produce a derivative is a matter of how the software was designed and what it is doing exactly when it makes the call (see the "mere aggregation" link above).

  1. GPL-ed JS is used in web page without any calls; is HTML/CSS bound by GPL?

It is possible to write Javascript code which is strongly bound to a particular HTML document. The Javascript code in this case would have hard-coded references to parts of the HTML document and would rely on that document's particular structure to work. This would be a strong indication that the Javascript and the document should be considered a single work.

But it is also possible to call generically written Javascript from a document and pass information to that Javascript using a well-established public API. This would be an indication that the works may be considered separate. The answer would be dependent on an analysis of the particular case at hand.

Does FSF's point of view coincides with Mozilla's in that minified/obfuscated JS is not source code?

The FSF's view is codified in the terms of the GNU GPL. The GPL defines source code as the preferred form for making modifications to the work. This obviously excludes all forms of obfuscated or unreadable code.

I would also recommend reading: https://www.gnu.org/philosophy/javascript-trap.en.html

  • This volunteer's analysis reminds that a case by case situation assessment is necessary, thus we can at least conclude that it is wrong to think that a javascript library under GPL would automatically "infect" the full webpage. It really depends on how tightly coupled the webpage and the library are. – Zimm i48 Sep 21 '16 at 7:59
  • 2
    @Zimmi48 honestly I see it as that JS' licensing is so unexplored that they have yet to form an opinion and just not sure themselves. I would think that with more precedents they will formulate something no so vague. – ZeroUnderscoreOu Sep 21 '16 at 21:36

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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