How do I create a computer virus?

Updated: 06/30/2020 by Computer Hope
Note

This page doesn't provide information on how to create a computer virus. Computer Hope doesn't condone the creation of or use of computer viruses, and therefore doesn't provide training on how to create a virus. This page discusses the reasons for not creating viruses and alternate options that you could pursue.

Computer Virus

If you are interested in creating a computer virus, trojan, worm, malware, or another 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 results 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

Computer programming

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 code into other files to corrupt them. It accomplishes these tasks by copying itself to other areas in memory or by spreading to other computers and areas the logged in user can access. By learning to program, you'll understand how viruses work in addition to gaining other skills.

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.

I need to test my virus scanner

You can create test virus files to test your computer's antivirus scanner without having to create one. 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's on your record and would make it impossible to get hired at any respectable computer company or 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 Bill Gates and what he has done for computers but has never heard of Jeffrey Parson.

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

Bug bounty

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, even pay good money to anyone who reports bugs or security vulnerabilities about any of their products.

I need details, examples, or other information about creating viruses

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