The invention provides a solenoid valve and a mass flow controller. The solenoid valve includes a solenoid, a valve body assembly, a valve core assembly, a plug assembly, and a valve port component, wherein the valve core assembly, the plug assembly, and the valve port component are stacked in sequence. Placed in the accommodation chamber of the valve body assembly, the valve core assembly is movably arranged in the accommodation chamber, the plug assembly includes a magnetic seat and a plug, the magnetic seat is fixedly arranged in the accommodation chamber, and the plug is movably arranged In the mounting hole of the magnetic seat, the valve core assembly is in point contact with the plug, and the end face of the valve port part facing the plug assembly is provided with a valve port, and the plug is set opposite to the valve port; the electromagnetic part is used to magnetize the valve core assembly and the magnet. seat, so that the magnetic seat attracts the valve core assembly to move, and then drives the plug to move, and adjusts the distance between the plug and the valve port. The electromagnetic valve and the mass flow controller provided by the present invention can improve the working reliability and reduce the difficulty of assembly, so as to improve the first-time assembly pass rate, reduce the processing difficulty of parts and components, reduce the processing cost, and reduce their own volume.