Judges will be obliged to impose the measure on almost all those convicted of sexual offences against vulnerable victims.
Switzerland has banned paedophiles from ever working with children.
The rules will come into place at the beginning of 2019 and oblige judges to impose a ban on anyone who has committed a sex crime against a child or vulnerable adult. Vulnerable adults include those who have an illness or are unable to resist or give informed consent as well as those who are dependent on their abuser. Sexual harassment will be included in the list of offences.
The only exception will be around youths who may engage in sexual activity with minors of a similar age.
The Swiss population backed the measures in a 2014 referendum