The invention relates to a solenoid valve (10) for a hydraulic braking system, comprising: a magnetic assembly; a pole core (11); a guide sleeve (13) joined to the pole core (11); a valve armature (20) running axially movably within the guide sleeve (13), the armature being drivable in opposition to a force of a restoring spring (16) by means of a magnetic force produced by the magnetic assembly,or being drivable by the force of the restoring spring (16), and said armature moving a plunger (30) comprising a closing element (34); and a valve body (15) connected to the guide sleeve (13) and comprising a valve seat (15.1) that is located between at least one first flow opening (15.2) and at least one second flow opening (15.3), the plunger (30) being fixedly connected to the valve armature (20). The invention also relates to a hydraulic braking system comprising a solenoid valve (10) of this type. The valve body (15) has a receiving region (19) which at least partially accommodates a guide assembly (40), the valve armature (20) running axially through at least one through-opening (41.1, 44.1) of the guide assembly (40), a mechanical detent device (18) being formed between the guide assembly (40) and the valve armature (20), the detent device releasing the valve armature (20) when the latter is in a de-energised closed position, such that the restoring spring (16) drives the valvearmature (20) and pushes the closing element (34) sealingly into the valve seat (15.1) to produce a sealing function, and said detent device fixes the valve armature (20) in a de-energised open position against the force of the restoring spring (16) in an axial detent position, such that the closing element (34) is raised from the valve seat (15.1).