An electroencephalogram (EEG) is a test that detects electrical activity in your brain using small, flat metal discs (electrodes) attached to your scalp. Your brain cells communicate via electrical impulses and are active all the time, even when you're asleep. This activity shows up as wavy lines on an EEG recording. An EEG is one of the main diagnostic tests for epilepsy. An EEG may also play a role in diagnosing other brain disorders.