A compact solenoid including a coil and a frame located outside the coil for constituting a magnetic circuit. The frame includes four bars extending in parallel to the axial direction of the coil and located proximate to the outer circumferential face of the coil. Each of the bars has a generally triangular cross section. The four bars are disposed to have a mutual positional relationship corresponding to vertexes of a square.