Before running a calculation you must first find out what rate your brokerdealer is charging to borrow money. The broker should be able to answer this question. Alternatively, the firm's website may be a valuable source for this information, as should account confirmation statements and/or monthly and quarterly account statements. In any case, once the rate being charged is readily known, grab a pencil, a piece of paper and a calculator and you will be ready to figure out the total cost.
Suppose you want to borrow $30,000 to buy a stock that you intend to hold for a period of 10 days.
In order to calculate the cost of borrowing simply:
Take the amount of money being borrowed and multiply it by the rate being charged:
$30,000 x .06 (6%) = $1,800
Then take the resulting number and divide it by the number of days in a year. The brokerage industry typically uses 360 days  not 365:
$1,800 / 360 = 5
Next, multiply this number by the total number of days you have borrowed, or expect to borrow, the money on margin:
5 x 10 = $50.
Using this example, it costs $50 to borrow $30,000 for 10 days.
To learn more about margin, see the Margin Trading tutorial.
RELATED FAQS

What is liquidity risk?
Learn how to distinguish between the two broad types of financial liquidity risk: funding liquidity risk and market liquidity ... 
What does the gearing ratio say about risk?
Find out why lenders and investors pay close attention to a firm's gearing ratios, and why both too much and too little borrowing ... 
How do hedge funds determine what assets to own?
Learn about the various types of investments that hedge fund managers use, and explore basic hedge fund management trading ... 
Which leverage ratios are most useful for analyzing manufacturing companies?
See which leverage ratios investors and creditors are likely to use when analyzing the debt burdens for manufacturing companies.

Ceded Reinsurance Leverage
The ratio of ceded insurance balances to policyholders’ surplus. ... 
David Einhorn
Known for his short selling strategy, activist investor David ... 
Short Call
A type of strategy regarding a call option, which is a contract ... 
Total DebttoCapitalization Ratio
An indicator that measures the total amount of debt in a company’s ... 
Equity Multiplier
The ratio of a company’s total assets to its stockholder’s equity. ... 
Leveraged Buyback
A repurchase of significant amount of shares through the use ...