The present invention can prevent a lid from tilting when the lid is attached to a substrate. An electronic device 200 includes: a substrate 202; an electronic component mounted on the substrate 202; and a lid 100 including a cover portion 102 protruding in a direction opposite the substrate 202 and covering the electronic component and a flange portion 104 arranged at the periphery of the cover portion 102 and adhered to the substrate 202. A protrusion portion 106 protruding for a predetermined height in a direction of the substrate 202 compared to other areas of the flange portion 104 is arranged on the flange portion 104 of the lid 100.