Ear infections can be caused by both viruses and bacteria. Inner ear infections are often viral, while outer and middle ear infections can be bacterial, fungal, or viral.