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 the difference between a sunk cost and an opportunity cost?
Discover the difference between the sunk costs of an investment and the opportunity costs associated with the decision to ... 
What is the difference between initial margin and maintenance margin?
Learn the difference between an initial margin requirement and a maintenance margin requirement and how these affect an investor's ... 
How exactly does buying on margin work and why is it controversial?
Learn how purchasing stock on margin works, and understand the risk associated with margin accounts that make the strategy ... 
Which financial ratio best reflects capital structure?
Learn about the debttoequity ratio and why this metric is widely considered the most useful reflection of a company's capital ...

Open Trade Equity (OTE)
Open trade equity (OTE) is the equity in an open futures contract. 
Leverage Ratio
Any ratio used to calculate the financial leverage of a company ... 
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 ...