Cefdinir is a generic prescription medication used to treat certain bacterial infections. In children ages 6 months to 12 years, cefdinir is also used to treat otitis media (middle ear infection).