The invention relates to a CMOS comparator wherein four p-channel lateral high voltage transistors (T11-T14) form two first current mirrors and two n-channel lateral high voltage transistors form a second current mirror. A depletion transistor (T2) located in the current path of the reference voltage determines the current flowing there. If the input voltage (UIN) is equal to the reference voltage (URef) the same current flows in both current paths. If the input voltage (UIN) deviates from the reference voltage (URef) the output voltage is modified substantially.