Margin in Forex and CFD trading is the amount of your own money you need to use to open a position with a broker. The amount of margin you put forward is multiplied by the amount of leverage given by your broker. The more leverage you have, the less money you need to use to open a position. Leverage is considered a loan from your broker to open the position. The concept of leverage and margin do overlap but they are also quite similar.
If you want to open a position of 1 Lot (100,000) EUR/USD and your broker is giving you 1:500 leverage, you only need to give €200 as margin. While leverage is expressed as a ratio, Margin is expressed as a percentage. In this case, 0.2% (€200) of the €100,000 is put forward as margin. The margin required to open the position is 0.2%.