Plan B

Can someone explain to me how exactly plan b works? Like does it stop you from basically getting pregnant or just decrease your chances?