It’s not good enough to simply say “I release this software into the public domain”.

Well, technically, it is (as in you have the right to do so…)
but technically it isn’t.

If it’s at all important to you to not put others in any sort of legal grey zone when using your code, you ought to use an SPDX-valid license.

Specifically for releasing to the “Public Domain” you should consider the Creative Commons Zero v1.0 Universal (or “CC0-1.0” for short), previously known as the “CC0 Public Domain Dedication (or CC-PDDC)”.

The CC0-1.0 Standard Header looks like this:

<project name> - <short project description>

Written in <YYYY> by <name> <email>
To the extent possible under law, the author(s) have dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.

You should have received a copy of the CC0 Public Domain Dedication along with
this software. If not, see <https://creativecommons.org/publicdomain/zero/1.0/>.

How to use the CC0-1.0?

If you don’t care about attribution or warranty or patents or any of it, you just want to “open source” your software, then do at least one of these:

  1. Put the Standard Header at the top of each file.
  2. Put the Standard Header (or Full License), in the root of your project in a file named one of the following:
    • COPYING (or COPYING.txt)
    • LICENSE
  3. Put the SPDX identifier CC0-1.0 in the license field of your package manifest (if any), such as:
    • package.json
    • Cargo.toml

For the convenience of other humans it’s also common to put the standard header or SPDX license id in the README.md, but if you do that, you should still pick at least one of those other 3 places as well.

Here’s an example of what it looks like, filled out, in a JavaScript file:

/**
 * @license
 * walk.js - fs.walk for node.js (a port of Go's filepath.Walk)
 *
 * Written in 2020 by AJ ONeal <coolaj86@gmail.com>
 * To the extent possible under law, the author(s) have dedicated all copyright
 * and related and neighboring rights to this software to the public domain
 * worldwide. This software is distributed without any warranty.
 *
 * You should have received a copy of the CC0 Public Domain Dedication along with
 * this software. If not, see <https://creativecommons.org/publicdomain/zero/1.0/>.
 */

Why so formal?

You see, despite having existed as long as the Earth, “Public Domain” is simply something that lawyers - and therefore companies larger than 2 or 3 people - just don’t seem to understand. Those words alone simply aren’t clear enough to define your intent across countries and cultures in the modern, global world of the Internet. You (or someone else at least) need(s) a “real” license.

If you’re going to go through the trouble to open source something at all, you want to bother at least enough to use a software license that meets these 3 criteria:

  1. Is recognizable by automated tooling (meaning SPDX-compatible)
  2. Covers your butt (meaning you don’t get sued for being a Good Samaritan)
  3. Has a short “Standard Header” (meaning you can copy a short snippet)

Bonus points if it’s FSF and OSI approved.

1. Why SPDX?

We all want to keep lawyers out of the mix as much as we can. That’s what the Software Package Data Exchange (SPDX) license registry is good for.

Companies like Google have already done the hard work of figuring out which software licenses are either in conflict with one another, or actually legally dangerous (i.e. sneaky fine print signing away your first born child), so when you publish with a SPDX-listed license, automated tools can identify potential legal issues without getting any legal personnel involved for special permission, problem solving, etc.

2. Good Samaritan Insurance

Believe it or not, people get sued for absolutely rediculous things - like a burgler slipping on ice while attempting to rob their property.

In fact, anyone can sue anyone for any reason, or no reason at all.

The best you can do is cover your butt so that such a lawsuit won’t stand up in court.

“Public Domain” doesn’t do this for you. CC0-1.0 does - by disclaiming warranties and other assumptions that could be implied in some countries and jurisdictions. Use it.

3. The People You Love Don’t Read LICENSE.txt

As you well know, legal documents are largely unintelligible.
That’s why you want a license with a short, intelligible “Standard Header” that clearly expresses your true intent in as few words as possible.

The CC0-1.0 does this pretty well:

To the extent possible under law, the author(s) have dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.

And follows it up perfectly:

You should have received a copy of the CC0 Public Domain Dedication along with
this software. If not, see https://creativecommons.org/publicdomain/zero/1.0/.

Many common licenses do this, but CC0-1.0 does it particularly well.

Bonus: FSF and OSI approved

Ideally you want to pick a license that’s been approved by both the Free Software Foundation (FSF) and the Open Sounce Initiative (OSI).

Again: greater compatibility, fewer lawyers (people we don’t want involved) involved.

When it comes to Public Domain licenses there aren’t many options, and of the few you do have, the most popular are the “parody” licenses, such as the WTFPL and GLWTPL.

The CC0-1.0 is the only “serious” Public Domain license that’s recognized by at least one of the FSF or OSI.

Bonus Bonus

Guess what! I don’t actually have to say “I’m not a lawyer, this is not legal advice”.

You know why? Because I’m not a lawyer! And this is legal advice (it’s just not legal, legal advice) and we don’t have any sort of relationship that would so imply or otherwise confuse the issue. Rather it’s technical advice for people like you and me who want to release projects into the Public Domain.

Anyway, I just wanted you to know that I believe this is good advice and I’m not afraid to say so. So take it! (if you want to)