How do I create a computer virus?

Note: This page does not provide information on how to create a computer virus. Computer Hope does not condone the creation of or use of computer viruses, and therefore we will not provide training on how to create a virus. This page is intended to discuss reasons for not creating viruses and alternate options that you could pursue.

Computer VirusIf you are interested in creating a computer virus, trojan, worm, malware, or other malicious program as revenge, payback, or as a prank, we suggest you rethink. Creating a virus that deletes files or causes other issues resolves nothing and will result in prosecution by the law. In other words, you could be fined or sent to prison.

Instead of creating computer viruses or other malware, consider learning a computer programming language. You will learn a lot more by learning one or more programming languages and become more qualified in getting hired at a company that designs programs or analyzes viruses. No one ever got hired because they wrote a computer virus.

I only want to write a virus to learn how they work.

You will learn a lot more about how computer programs and viruses work by learning to program than you ever will by writing and tinkering with computer viruses. A computer virus is a program solely designed to do malicious tasks, such as deleting files or inserting its code into other files to corrupt them. It accomplishes these tasks by copying itself to other areas in memory or by spreading to computers with access to a machine that has the virus. By learning to program, you will understand how viruses work in addition to ganing other skills.

I need to test my virus scanner.

You can create test virus files that can be used to test your computer's anti-virus scanner without having to create your own virus. See the link below for additional information and code on how to create a test virus.

If I create a good computer virus, I will be famous.

No, the only fame you may get is a brief news article or a picture of you being handcuffed and sent to prison. Once incarcerated, it will go on your record and make it next to impossible to get hired at any respectable computer company and impossible to get hired by any government agency.

If you were to write a computer virus that was successful, you would want to remain anonymous in fear of being prosecuted by the law. Also, if you think about it, almost everyone knows who Bill Gates is and what he has done for computers, but have no clue about Jeffrey Parson.

If I write a good virus, a security firm or antivirus company will hire me.

False, no respectable security firm or antivirus company wants to be affiliated with a virus or malware creator that infected potential customer computers. If you are interested in getting a job with a security firm or antivirus company, you have a much better chance by learning to program. Doing things like becoming a participant in security discussions, being a beta tester, or finding and reporting program vulnerabilities are recommended. Companies such as Google will even pay good money to anyone who reports bugs or security vulnerabilities about any of their products.

In need details, examples, or other information about creating viruses.

Computer Hope will not send anyone any other additional information about creating computer viruses, worms, or trojans. This document was only created to help deter people from creating computer viruses and learn computer programming instead.

What programming languages should I learn?

Programming languages such as C, C++, C#, Java, Perl, PHP, and Python are all good programming languages for new computer programmers. See the link below if you are not exactly sure what language to start learning first.