A cofounder who leaves and takes the code has not automatically taken anything that was legally theirs to take. Ownership turns on whether the company ever secured a written IP assignment, not on who typed the most commits. Many startups never sign that document, which turns an exit into a real ownership fight.
Who owns the code when a cofounder leaves?
Under copyright law, the person who writes the code owns it by default. That default only flips to the company if the writer was an employee acting within the scope of their job, a doctrine usually called work for hire, or if they signed a written assignment handing their rights to the company.
Most early startups skip the paperwork because everyone trusts everyone. That trust is exactly what breaks down when a cofounder leaves on bad terms. The departing cofounder's lawyer will ask one question first: where is the signed assignment. If the answer is nowhere, the company's claim gets weaker fast.
Does it matter if the code predates incorporation?
Yes, and this is where most startups are exposed. Code written before the company legally existed was not written for any employer, so there is no employment relationship to pull ownership toward the company. The usual fix is a retroactive IP assignment, signed by every founder once the entity is formed, that pulls all pre-incorporation work into the company.
If your startup never did this step, a departing cofounder who wrote the original prototype has a stronger legal position than most teams assume. This is one reason a founder IP assignment agreement belongs on the same day as your cap table, not somewhere on a someday list.
What should you do the moment a cofounder with access leaves?
Move fast and in this order:
- Revoke repository, cloud and credential access the same day the departure is final, not after the conversation gets emotional.
- Pull every signed agreement that might cover the code: employment contract, founder agreement, IP assignment, even an old email that references ownership.
- Audit what was written before incorporation versus after, since the legal footing differs for each.
- Get a lawyer to assess your actual position before you say anything in writing about who owns what.
- Decide your target outcome before you negotiate: full ownership, a license to keep using it, or a clean rewrite if the claim is too weak to fight.
How do these disputes usually get resolved?
Rarely in court. A full IP lawsuit over code ownership is slow, costly, and uncertain even when the facts favor you, so most disputes end in a negotiated settlement: a payment for a clean assignment, a license that lets the company keep using the code while the departing cofounder keeps nominal credit, or in the worst cases, a decision to rewrite the contested parts from scratch.
| Your position | Likely path |
|---|---|
| Signed assignment exists, covers the disputed code | Assert ownership directly, limited negotiation needed |
| No assignment, but writer was a W-2 employee | Work-for-hire argument, moderate strength, still worth legal review |
| No assignment, writer was a contractor or pre-incorporation | Weak claim, negotiate a buyout or license, or plan to rewrite |
How do you stop this from happening again?
Fix the gap before the next hire, not after the next departure. Every founder and every contractor should sign an IP assignment before they write a line of code the company will rely on, and that document should explicitly reach back to cover anything written before the agreement was signed. A cofounder agreement checklist that nobody actually reads is not a fix; a signed assignment on day one is.
If the relationship is still salvageable and the code dispute is really standing in for a bigger falling out, a Conflict Session gives you a structured way to separate the ownership question from the personal one, so you are negotiating one problem at a time instead of all of them at once. For the wider picture on repairing a partnership before it reaches a lawyer, start with our cofounder conflict resolution guide.
Frequently asked questions
- Can a cofounder legally take the code when they leave?
- Only if nobody assigned it to the company first. Code belongs to whoever wrote it unless a written agreement transfers it, or the writer was an employee working within the scope of their job. Many early cofounders skip that paperwork, so the person who wrote the most code can have a real claim.
- Who owns code written before the company was incorporated?
- Whoever wrote it, by default. Pre-incorporation code was not created inside any company, so there is no employer to claim it automatically. Founders usually fix this with a retroactive assignment once they incorporate, but if that step was skipped, the departing cofounder's claim to that earlier code is stronger.
- What if we never signed an IP assignment agreement?
- You have a real problem, not just a paperwork gap. Without a signed assignment, ownership depends on messy facts: who wrote which parts, whether anyone was an employee at the time, and what state or country's law applies. Get a lawyer before you touch the repository or make any public claim about ownership.
- How do you get the code back from a departing cofounder?
- Start with the agreement you do have, even an informal one, and a lawyer's letter asserting the company's claim. If there is no assignment at all, you may need to negotiate: a buyout, a license, or a rewrite. Litigation is slow and expensive, so most of these disputes settle before trial.
