Can You Copyright AI-Generated Code?
The Copyright Office has already answered this, and the answer is that prompts alone do not make the output yours. Here is what that means for a real repository.
You can copyright AI-generated code only to the extent a human contributed protectable expression to it. Purely machine-written code is not yours to register, and writing the prompt that produced it does not make it yours either. What you can claim is your own code in the file, your creative selection and arrangement of the generated parts, and your creative modifications of them. That is the US Copyright Office position, it is stated plainly, and almost nobody building with AI has read it.
Three separate questions get merged into this one, and untangling them first saves a lot of confusion:
Can you copyright it? Covered below. Partly, on a case-by-case basis.
Can you use it commercially? Almost always yes. That is governed by the terms of the tool you used, not by copyright law.
Could it be somebody else's code? A different risk entirely, dealt with at the end.
What the Copyright Office actually concluded
The Office published its analysis as Part 2 of its report on copyright and artificial intelligence on 29 January 2025, under the heading of copyrightability. Its conclusions, as the report's own executive summary states them:
"Questions of copyrightability and AI can be resolved pursuant to existing law, without the need for legislative change."
"The use of AI tools to assist rather than stand in for human creativity does not affect the availability of copyright protection for the output."
"Copyright protects the original expression in a work created by a human author, even if the work also includes AI-generated material."
"Copyright does not extend to purely AI-generated material, or material where there is insufficient human control over the expressive elements."
"Whether human contributions to AI-generated outputs are sufficient to constitute authorship must be analyzed on a case-by-case basis."
"Based on the functioning of current generally available technology, prompts do not alone provide sufficient control."
That sixth point is the one that surprises people, and the reasoning behind it is worth reading rather than paraphrasing. The Office states that "prompts alone do not provide sufficient human control to make users of an AI system the authors of the output. Prompts essentially function as instructions that convey unprotectible ideas. While highly detailed prompts could contain the user's desired expressive elements, at present they do not control how the AI system processes them in generating the output."
It also notes the gap gets wider, not narrower, with tools that rewrite your prompt internally before generating: "That process recasts the human contribution, however detailed it may be, into a different" form, which weakens the control argument further.
The Office does leave the door open on technology, not law. "In theory, AI systems could someday allow users to exert so much control over how their expression is reflected in an output that the system's contribution would become rote or mechanical." Its finding is that today's systems are not there.
Two framing notes before anyone over-reads this. The report addresses copyrightable works generally and does not single out software. And this is US law: other jurisdictions reach different answers, and the UK, EU member states and others each have their own test for authorship.
What this means for a real codebase
A repository built with an AI agent is not one work. It is a pile of files with different provenance, which is exactly the case-by-case situation the Office describes.
What is in the file | Protectable by you? |
|---|---|
Code you wrote by hand | Yes, normally |
Code the model generated from your prompt, unmodified | No |
Generated code you then substantially rewrote | Your modifications, yes |
Your architecture, module layout, and which generated pieces you kept and in what order | Your creative selection and arrangement, yes |
Boilerplate the model produced that anybody would produce | No, and it was probably never protectable anyway |
The Office's own words on the upside: "Human authors are entitled to copyright in their works of authorship that are perceptible in AI-generated outputs, as well as the creative selection, coordination, or arrangement of material in the outputs, or creative modifications of the outputs."
For most working software this is less dramatic than it sounds. A real project is reviewed, refactored, wired into a specific architecture and corrected repeatedly by a person. There is usually plenty of human expression in it. What there is not is a clean claim over every line.
If you are registering, which most people never do
Copyright exists the moment a work is fixed. Registration is a separate administrative step that mainly matters if you intend to sue somebody in the United States. If you do register:
Disclose the AI-generated material rather than ignoring it. The Office publishes registration guidance for works containing AI-generated material, and it expects the applicant to identify it.
Claim your own contribution specifically, not the whole file.
Keep a record of what you changed. Not for the Office, for your own ability to answer the question in two years when nobody remembers.
An unregistered claim is still a claim. The practical cost of getting this wrong is almost never a registration refusal. It is making a promise in a client contract you cannot keep.
The contract problem, which is the real one
Here is where this stops being academic. A standard development agreement says the developer assigns all intellectual property in the deliverable to the client, and warrants that they own what they are assigning.
If a meaningful share of the deliverable is unmodified model output, you cannot assign copyright in it, because you never had it. You are not committing fraud, you are promising something that does not exist. The honest version of that clause assigns what you own and acknowledges that parts of the work may not be subject to copyright in anyone's hands.
What to actually do:
Say that you use AI tools in the build, in the contract, not in a conversation. Finding out later goes badly, as covered in when a client finds out you used AI.
Assign what you have and warrant only that you have not knowingly included third-party code without a compatible licence.
Do not warrant exclusivity in generated output. Two clients prompting similarly can get similar code, and neither can stop the other.
If a client needs a hard IP position, for an acquisition or a patent strategy, that is a conversation with their lawyer before the build starts, not after.
Related reading on clause-level negotiation: when a client puts a no-AI clause in the contract.
The risk people should worry about instead
Copyright in your output is a small problem. Someone else's licensed code arriving in your output is a bigger one. A model trained on public repositories can reproduce distinctive code, and if that code came from a copyleft project, the licence obligations attach to the code, not to how it reached you. No prompt dissolves a licence. We covered the detection and remediation side in when an AI coding agent copies licensed code.
The same logic covers generated images and logos, where the ownership question lands differently because trademark does work copyright will not. That is in can you own an AI-generated logo.
Frequently asked questions
Does a very detailed prompt change the answer?
Not under current US guidance. The Office considered exactly that argument and concluded that detailed prompts may reflect your idea without controlling the expression, which is the thing copyright protects.
Can I still sell software built with AI?
Yes. Commercial use is governed by the terms of the tool you used, and the major coding tools permit it. Whether you can stop somebody copying your code afterwards is the question copyright answers, and the answer is partly.
What if I heavily edited everything the model wrote?
Then you are in much better shape, because your modifications are your expression. Keep enough of a record that you can say what you changed.
Is this settled law?
The Office's conclusions are its interpretation of existing law, not a statute, and litigation on adjacent questions continues. The Office says it "will continue to monitor technological and legal developments to determine whether any of these conclusions should be revisited." Treat it as the best current guide, not the last word, and take advice from a lawyer in your jurisdiction before you sign something that depends on it.
For the broader risk picture, see our practical guide to AI risks for builders.
How did this land?
About the author

Senior Editor, AI & Product
Cecilia leads the Swarmz editorial desk. She has spent a decade turning complex AI and product topics into writing people actually finish, and she owns the blog's quality bar.


