An electroencephalogram (EEG) is a noninvasive test that records electrical patterns in your brain. The test is used to help diagnose conditions such as seizures, epilepsy, head injuries, dizziness, headaches, brain tumors and sleeping problems. It can also be used to confirm brain death.