How to create a computer virus

Updated: 06/30/2020 by Computer Hope

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

Computer Virus

If you want to create a computer virus, trojan, worm, malware, or another malicious program as revenge, payback, or 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 malware, consider learning a programming language. You will learn more by learning one or more programming languages and become more qualified to get 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 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 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 and gain other skills.

What programming languages should I learn?

Programming languages such as C, C++, C#, Java, Perl, PHP (PHP: Hypertext Preprocessor), and Python are good programming languages for new computer programmers. See the link below if you are unsure what language to learn first.

I need to test my virus scanner

You can create test virus files to test your computer's antivirus scanner without creating or downloading one. See the link below for additional information and code on creating 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 getting hired at any respectable computer company or government agency impossible.

If you were to write a successful computer virus, you would want to remain anonymous for 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 infects potential customer computers. If you're interested in getting a job with a security firm or antivirus company, you have a better chance by learning to program. Participating in security discussions, being a beta tester, or finding and reporting program vulnerabilities are recommended. Companies, like Apple, Google, and Microsoft 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.