BACKGROUND Electroencephalography (EEG) is a useful diagnostic tool in the diagnosis of seizure and differentiating it from seizure-like attacks. Cooperation and immobility of the patient is crucial and in children who do not naturally sleep, pharmacological agents and procedural sedation should be used for sleep inducement. The purpose of this study was to compare efficacy and safety of melatonin and intravenous solution of midazolam administered orally in sedation induction for EEG of children. METHODS In a parallel single-blinded randomized clinical trial, sixty 1 - 8 year old children who were referred to EEG Unit of Shahid Sadoughi Hospital, Yazd, Iran from September 2011 to March 2012 were evaluated. The Children were randomly assigned into two groups to receive orally 0.3 mg/kg melatonin or 0.75 mg/kg ampoule of midazolam. The primary outcome was efficacy in adequate sedation (Ramsay sedation score of four) and recording of EEG. Secondary outcome was clinical side effects. RESULTS Nineteen girls (31.7%) and 41 boys (68.3%) with the mean age of 2.8 ± 1.8 years were evaluated. Adequate sedation and recording of EEG was achieved in 36.7% of midazolam group and in 73.3% of melatonin group, (p = 0.004). Transient agitation was seen in 6.6% of midazolam group. No significant difference was observed from the viewpoint of side effects frequency between the two drugs, (p = 0.15). CONCULSION Melatonin is a safe and an effective drug in sedation induction for EEG in children.