A virus is illegal computer code that can alter programs or destroy data. A virus can copy itself onto programs, spreading its damaging effects.