Published on November 20, 2026
Estimated Read Time: 6 minutes
Wondering about trade secret or copyright for code? Copyright protects what you wrote, trade secret law protects what stays confidential, and most software teams should use both.
Most developers should use both. Copyright protects the written expression of your code automatically, while trade secret law protects whatever you keep confidential. The trade secret or copyright for code question is rarely either/or: copyright covers the text you wrote, and secrecy covers the logic and know-how you never publish.
The two protections work in different ways, and that's where people get tripped up. Copyright is a legal right that exists the moment code is fixed in a file. Trade secret protection is a status you earn and keep through your own behavior, and you can lose it by being careless.
This guide compares what each one covers, how secrecy works under both, and how a startup can combine them without undercutting itself.
Both can be true at once, but they attach for different reasons. Under 17 U.S.C. § 102, source code is a literary work, so copyright applies automatically to original code. Nobody has to register anything for that to happen. If you're unsure how much registration adds, the guide on whether you need to register a copyright to be protected covers it.
So is source code a trade secret? Only if it qualifies. Trade secret law, mainly the federal Defend Trade Secrets Act and state versions of the Uniform Trade Secrets Act, asks three things:
Code sitting in a public GitHub repo fails the second test. Code on a locked-down server, shared only with NDA-bound staff, usually passes.
Copyright protects expression, not ideas. It stops someone from copying your actual code, but it doesn't stop them from learning how your system works and writing their own version. Section 102(b) of the Copyright Act spells out that ideas, procedures, processes and methods of operation aren't covered.
Trade secret law fills that gap. It can protect:
The catch is that a trade secret protects against misappropriation, meaning theft, breach of an NDA, or other improper means. It doesn't stop a competitor who reverse-engineers your shipped product fairly, or who independently builds the same thing.
Copyright has no secrecy requirement, so it works for code you ship, publish, or sell. It also gives you something trade secrets never will: the right to sue anyone who copies your code, even if they got it legally. That makes it the stronger tool against piracy of distributed software. And it lasts a long time. For work you wrote yourself, that's your life plus 70 years.
Here's the side-by-side view.
| Feature | Copyright | Trade secret |
|---|---|---|
| How you get it | Automatic once code is written | Only if the code stays secret and has value |
| What it covers | The code text and structure you wrote | Confidential logic, data, and methods |
| Stops independent creation? | No, but stops copying | No |
| Works for shipped software? | Yes | Only for the parts users can't see |
| Registration | Optional, but needed before suing in the U.S. | None exists |
| Duration | Decades | As long as secrecy holds |
Notice the pattern. Copyright is durable and public-facing. Trade secrets are potentially unlimited in time but fragile. One leak, one careless contractor, one unprotected upload, and the status can vanish for good.
Yes, and for most commercial software that's the sensible default. Registering a copyright doesn't kill your trade secret, as long as you handle the deposit correctly.
When you register, the Copyright Office requires a copy of the work. For software, that normally means the first and last 25 pages of source code. But if the code contains trade secrets, the Office allows you to redact those portions or submit alternative formats. Deposited material becomes available for public inspection at the Office, so redaction is how you keep secrets out of it. The exact rules are in the walkthrough on submitting source code as a deposit with trade secret redaction, so follow those before you file.
Not automatically. Filing a properly redacted deposit is a recognized way to register while preserving secrecy. Filing an unredacted deposit of your crown-jewel logic is the mistake. A court could treat that as a failure to take reasonable steps.
Copyright registration costs $65 for a Standard Application, or $45 for a Single Application if you're the sole author and the work isn't made for hire. Copyright Engine prepares and files the application for you. For the filing process itself, the guide on how to copyright source code has the full steps.
Use both, but give them different jobs.
If you're also weighing patents, that's its own tradeoff, covered in the comparison of copyright vs patent for software. Note that a patent requires public disclosure, which is the opposite of keeping something secret.
A word of caution on open source. If you publish code under a permissive license, you can't call that same code a trade secret. Decide which pieces are public before you release anything.
This is legal information, not legal advice. For disputes, trade secret litigation, or tricky ownership situations, talk to an IP attorney.
Open your repo and list what ships to customers, what stays internal, and what's genuinely novel. Anything you distribute is a candidate for copyright registration. Anything that gives you an edge and stays private needs access controls and a redaction plan before you ever submit a deposit. Do that sorting this week, then register your next release with the secret parts removed from the deposit.