An electric compressor comprising: an electric motor; a compression mechanism arranged to be driven by the electric motor; a housing accommodating the electric motor and the compression mechanism; an accommodation part provided on a sidewall of the housing and accommodating a drive circuit for controlling the electric motor; a lid contacting the accommodation part and fastened to the accommodation part by a fastening means; and a sealing member sandwiched between the accommodation part and the lid so as to seal between them, wherein the sealing member is a gasket formed of a metallic core material and an elastic material disposed on both sides of the core material, and wherein the accommodation part includes a wall standing from the sidewall of the housing, characterised in that a step with a height is provided on a standing end surface of the wall at a midway position from an inside toward an outside of the accommodation part; the fastening means passes through the standing end surface located further on the outside than the step, and the sealing member is sandwiched between the lid and the standing end surface located further on the inside than the step; and the height of the step between the standing end surface located further inside than the step and the standing end surface located further outside than the step is set to satisfy the following formula: H − t / T − t = 0.2 to 0.32 where H: the height of the step between the standing end surface located further inside than the step and the standing end surface located further outside than the step; T: a total thickness of the gasket t: a thickness of the core material. an electric motor; a compression mechanism arranged to be driven by the electric motor; a housing accommodating the electric motor and the compression mechanism; an accommodation part provided on a sidewall of the housing and accommodating a drive circuit for controlling the electric motor; a lid contacting the accommodation part and fastened to the accommodation part by a fastening means; and a sealing member sandwiched between the accommodation part and the lid so as to seal between them, wherein the sealing member is a gasket formed of a metallic core material and an elastic material disposed on both sides of the core material, and wherein the accommodation part includes a wall standing from the sidewall of the housing, characterised in that a step with a height is provided on a standing end surface of the wall at a midway position from an inside toward an outside of the accommodation part; the fastening means passes through the standing end surface located further on the outside than the step, and the sealing member is sandwiched between the lid and the standing end surface located further on the inside than the step; and the height of the step between the standing end surface located further inside than the step and the standing end surface located further outside than the step is set to satisfy the following formula: H − t / T − t = 0.2 to 0.32 where H: the height of the step between the standing end surface located further inside than the step and the standing end surface located further outside than the step; T: a total thickness of the gasket t: a thickness of the core material. H: the height of the step between the standing end surface located further inside than the step and the standing end surface located further outside than the step; T: a total thickness of the gasket t: a thickness of the core material.