Illegal refers to doing something that is against the law.
Prohibited by law.
1) adj. in violation of statute, regulation or ordinance, which may be criminal or merely not in conformity. Thus, an armed robbery is illegal, and so is an access road which is narrower than the county allows, but the violation is not criminal. 2) status of a person residing in a country of which he/she is not a citizen and who has no official permission to be there.
Illegal, or unlawful, is used to describe something that is prohibited or not authorized by law or, more generally, by rules specific to a particular situation (such as a game).