No, not always. Hacking can be both illegal and legal depending on the circumstance. For example, if you hack into a computer system using an automated tool, on your own computer for research purposes, this would be legal. However, hacking on another person's computer without their consent is considered illegal.