I write code for company X in the USA using popular technology Y. In the course of my job I end up developing a number of useful libraries/widgets/utilities for use within the Y ecosystem that have nothing to do with X's business product per se: they are broadly useful across many applications. Some of these libraries/widgets/utilities are trivial to write, while others are elaborate and have taken months of work. The commonality is that none of them require any proprietary technology or information to function or to develop: any of them could be written by any Y developer sufficiently skilled and motivated.

The code I wrote is work made-for-hire and belongs to company X; let's take it as a given that I can't use or publish this specific source code outside the company. (Let's further assume that none of the code is patented.) Who owns the ideas, the knowledge of how these libraries work? If I need to solve the same problem again (or if I just want to publish open-source code), how close can my solution come to the original?

There are a number of related questions out there on Stack Exchange and elsewhere:

There are some very helpful answers in all those threads, but none of them really cover all the bases. I'm hoping this answer can be definitive by considering all the dimensions:

Similarity to original

  • What if the new code (presumably, in the case of something simple) comes out exactly the same (even if I rewrite it without looking)?
  • What if the new code comes out almost exactly the same?
  • What if the code achieves precisely the same function -- i.e., produces exactly the same outputs for the same inputs -- but works substantially differently?
  • What if I change variable names or otherwise obfuscate the code purely to avoid copyright infringement, without changing the functionality?

Circumstances under which the new code is derived

  • What if I copy-and-paste from the original, but update a bunch of stuff so that the algorithm / architecture / etc. is substantially different?
  • What if I look at the original code in one window while I re-type it verbatim in another?
  • What if I look at the original code as a reference but substantially change things as I re-write?
  • What if I don't look at the original at all, but it still comes out extremely close to the original?
  • What if I have a photographic memory and reproduce the entire code verbatim without looking?


  • What if the code is very complex and requires considerable engineering effort?
  • What if the code is simple and requires little time to reproduce once you know how it works?


  • What if I rewrite the code immediately after leaving company X?
  • What if I rewrite the code on nights and weekends while I'm still employed by company X?
  • What if I rewrite it N years later?

There may well be other dimensions I'm forgetting -- feel free to suggest them! My question is specifically about U.S. law, but illustrative points from other countries are welcome. I don't want to narrow the scope of the question to a single state within the US, so pointing out what is universal and what might differ between states would be very helpful.

  • 1
    Knowing what state you are in may change what IP restrictions are allowable in an employment contract.
    – Michael
    Aug 12, 2022 at 0:53

1 Answer 1



Let us assume that the code involved was created during the period of employment, was within the scope of that employment, and was validly work-made-for-hire (WFH). In that case, the code copyright is owned by the former employer.dn the person who wrote it has no more rights than a random stranger would. I am also going to assume US law.

Ownership of Ideas

Who owns the ideas, the knowledge of how these libraries work?

No one does. In the absence of a patent, no one ever "owns" an idea. ]17 USC 102(b)](https://copyright.gov/title17/92chap1.html#102) provides:

(b) In no case does copyright protection for an original work of authorship extend to any idea, procedure, process, system, method of operation, concept, principle, or discovery, regardless of the form in which it is described, explained, illustrated, or embodied in such work.

Derivative Works

Copyright law does prohibit anyone making a derivative work from a work protected by copyright without the permission of the owner. A derivative work is one "based on" the source work. The classic case is a translation. Exactly when a piece of software is a derivative work of another is fact-dependent. Bu several things are clear.

  • If the source work is trivial and obvious, ther may not be sufficient "originality" for the source work to be protected by copyright at all. If the source work is not protected by a valid copyright, nothing is a derivative work of it. A "hello world" program, for example, is probably not original enough for any copyright. A straight-forward implementation of a basic algorithm like quicksort is probably not original enough, either.

  • If there is only one way, or only a small number of ways, to express the ideas of the source work, the merger doctrine applies. This means that the expression of the work is merged into the idea, leaving the expression unprotected. When the merger doctrine applies, there is, in effect, no copyright.

  • If a work copies ideas from a source, but none of its particular expression of those ideas, the result is not a derivative work, and is not an infringement of copyright.

  • If a work is definitive, but is also a fair use of the source work, it is not an infringement. The usual four-factor fir use analysis must be made to determine this. In particular, if a work is highly transformative, it is likey to be found to be a fair use.

Issues from the Question

  • What if the new code (presumably, in the case of something simple) comes out exactly the same (even if I rewrite it without looking)?

That Rather suggests that the work was too trivial to be original enough to have copyright protection at all, or else that there are only a few ways to express the idea, and the merger doctrine applies. But if neither o those were true, this might be an infringement.

[* To be coninued*]

  • Patents don’t give you ownership of an “idea”; they give you ownership of an invention or process.
    – Dale M
    Aug 12, 2022 at 6:15
  • @Dale M True, but a patent can cover a "method or system" and come a lot clsoer to ownership of an idea than any copyright can. Aug 12, 2022 at 15:16
  • I'm struggling with point (3), the "particular expression" of the idea. Say I've already re-written a library several times for company X, and, through trial and error, discarded inferior implementations and figured out an optimal one. If I now re-write it again, it's highly unlikely I personally will find another way to do it that works as well. (Someone else, with a different background and skill set, might.) So it seems that I'll either violate the copyright or have to purposely choose an inferior implementation.
    – Sasgorilla
    Aug 13, 2022 at 18:05
  • @Sasgorilla that can be a a problem, unless the utility is such that the merger doctrine applies. Still, I have found that it is uprising how often re-thinking and use of a quite different algorithm will actually lead to gains in efficiency or performance. Dismissing the possibility of any improvement is self-fulfilling. But sometime ther is no significant improvement to be gained, or none worth the effort. Sometimes there is, but a particular coder just does not see it. In any case, if neither merger nor fair use applies, substantial direct copying without permission would be infringement Aug 13, 2022 at 18:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .