Firms active in OTC derivative markets increasingly use margin agreements to reduce counterparty credit risk. Making several simplifying assumptions, I use both a quasianalytic approach and a simulation approach to quantify how margining reduces counterparty credit exposure. Margining reduces counterparty credit exposure by over 80 percent, using baseline parameter assumptions. I show how expected positive exposure (EPE) depends on key terms of the margin agreement and the current mark-to-market value of the portfolio of contracts with the counterparty. I also discuss a possible shortcut that could be used by firms that can model EPE without margin but cannot achieve the higher level of sophistication needed to model EPE with margin.