These terms define different groups of hackers based on their behavior.
Black hats fit the widely-held stereotype that hackers are criminals performing illegal activities for personal gain and attacking others.
They’re the computer criminals.
White Hats
White-hat hackers are the opposite of the black-hat hackers.
For example, many white-hat hackers are employed to test an organizations' computer security systems.
The organization authorizes the white-hat hacker to attempt to compromise their systems.
Gray Hats
Very few things in life are clear black-and-white categories.
In reality, there’s often a gray area.
A gray-hat hacker falls somewhere between a black hat and a white hat.