This is a legal question with mixing code I've written in my own time with code I've been paid to write for an employer.

I'm employed at a company with an employment contract, and am paid hourly. This is in Ontario, Canada in case that that affects matters.

I've been working on a project for my employer, and in this project I've incorporated some code that I had previously written in my own time at my house for another project (as in I own the code outright).

My code is now tightly coupled with the project at work (as in it won't work without it). I have at times needed to make changes to my original code to get it working with my work project, and since I am paid hourly for my time, I've technically been paid to work on my own code.

But since I was paid for it, does my employer now technically own this code?

Suppose I leave this company tomorrow, do I need to leave my source code behind? I'm not saying I would, but do I still retain exclusive and unrestricted rights to my original code?

  • 5
    Really, you just need to contact a lawyer to review your contract to work it out. Next time, talk about it with your employer first so you can come to an arrangement before you end up in this position :) Commented Nov 1, 2011 at 22:14
  • Hi user808532, we really couldn't say without seeing your contract (please don't show us your contract): please consult a lawyer or discuss it with your boss.
    – user8
    Commented Nov 1, 2011 at 23:12
  • Yes. This will almost always fall under work for hire. You wrote the code during the hour/for them and they paid you, its theirs. If you used code from previous projects you really shouldnt have and those pieces may not be theirs but you cant stop them using it unless you try to use them which is probably not worth it and sometimes in contracts (highly likely not in yours) they can sue you for damages (in cause they are sued) of you using code you werent suppose to.
    – user2528
    Commented Nov 1, 2011 at 23:13
  • I would say yes the right thing to do would be to leave your code behind. In reality there are gray areas wrt code ownership and given enough time and money a smart IP lawyer could probably justify either side of the case. Commented Nov 2, 2011 at 2:22
  • 1
    Note that the question is whether he will still own his original code - ie. the unmodified code prior to working with the company. My expectation would be that the modified code would be the property of the company (depending on the contract), but the original code would still belong to him. However, if it's important, contact a lawyer.
    – user4234
    Commented Nov 2, 2011 at 10:35

5 Answers 5


This isn't the sort of question suited for SO, but with that said, I'll throw you some quick points before it gets closed or migrated.

Firstly, you would need to consult a lawyer. There is no substitute for speaking with someone who can provide you with correct advice rather than the random mumblings of most people online.

Anyway... Employment Law is pretty complex, especially when it comes to Intellectual Property Rights.

For example, if you are employed by a Manufacturing company to create some Wonder Design, then discover the perfect design in your own time, your employer will generally (without an agreement pointing otherwise) be the owner of any Copyright in the works which you produce.

Also, you would need to determined if you are actually employed by this person who you have done work for. Just because you call him your employer, does not mean that he is in fact your employer. In fact, even because he pays you in renumeration for work you have completed, does not mean he is your employer. This is all pretty complex stuff too and it all boils down to contracts, the length of the work you completed, how you received your money, your tax obligations, etc.

Additionally, the fact that you have included this preexisting code into this project does not mean that you relinquish any Copyright in your work.

You are still the owner of the Copyright in your works, however, you will have most likely granted an implied licence to use your work since you have included it in this project. This of course, is making the assumption, that the work you carried out, has assigned all Intellectual Property Rights in this person who hired you.

It might actually be the case that you were paid for work, but you retain full IPR and you have just granted a licence to use the software which you have developed.

If I was to offer my non legal opinion based on what you have provided so far, I would say that this person is your employer, and that the Intellectual Property Rights in the work you have created thus far is held by your employer. You have Copyright in the work which you yourself have created, however, you will have granted an irrevocable implied licence to your employer to use your work, and additionally any chance which you now make on this project will belong to your employer.

Also remember, you can have Copyright in even infringing works of Copyright. And just because you have Copyright in something, doesn't always mean that it is enforceable.

I would recommend that you:

  • Dig up your contracts
  • Create an agreement with your employee that recognises that you are grantee free use of your own code for this project, however, it should also be noted that any work that you do in your own time is your own work.

The answer will be in your contract.

My contract at work stats that all code written during my employment with the company is owned by the company.

Check your contract.

  • 3
    Not all clauses in a contract are enforceable. Companies put them there as a intimidation because they figure you will not hire a lawyer. The answer is consult a lawyer to read your contract fro the enforceable portions. Commented Nov 1, 2011 at 22:24
  • There are local laws as well. Check against them, too. Contracts are based on these local laws.
    – hakre
    Commented Nov 13, 2011 at 13:10

I'm not a lawyer, but it sounds like there's a chance things are kind of a mess. Your contract probably says your employer owns the code you do on their time, and maybe the code you do on your time as well.

If your employer owns the parts you did on their time but not the rest, and you own the parts you did on your time, and if isn't 100% clear which parts were done when, then it's possible that neither you nor your employer enough legal rights to enough of the code to be able to use it with confidence.

Because things like this aren't unknown, there is a fairly good chance that something in your contract gives them ownership of the code you wrote in your own time. And even if you still own some of the code you wrote in your own time, you have to consider the possibility that your employer could later try to claim ownership of your project because it's based on code they own. Which means if you sell the code without disclosing that you might not own it, you might be accused of acting in bad faith, or I suppose of fraud. And who will buy it if they aren't sure you own it?

These are just some of the things I can think of that might go wrong, but it seems like a complicated legal question to me, so I really don't know.

On the good side, probably your employer isn't out to steal your code and you aren't out to steal theirs, so it seems like there is a good chance you could resolve it all amicably in any case, even after the fact. Your employer may well let you have whatever intellectual property rights it feels it can give you while still protecting it's own interests.


Not sure on the wording of your particular contract but yes most likely the employer owns the code. You were paid for the work and it is property now. As for the code you created at home on your own time, I am no contract lawyer but that should be yours but only that code.


As with others, I am not a lawyer but have been involved in some interesting questions like this ... in my opine (and ONLY my opinion) this is where your argument likely fails:

as in I own the code outright

The minute you put it in your employers code-base, even if you had developed it PRIOR to joining the company, you forfeit your right of ownership.

The other thing to consider is even if you are LEGALLY in the right, what is it worth to you to defend? If you did leave the company, and they decided to come after you hard, how much would it cost you to PROVE ownership? Likely they could (and if were the churlish type would) bury you in court costs, making it not worth time/cost to exert privilege.

  • 1
    No you don't. This is totally ambiguous/wrong advice.
    – Laykes
    Commented Nov 1, 2011 at 23:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.