sharpe ratio calculator formula example

Sharpe ratio calculator, formula, examples

The Sharpe ratio is a popular tool used in performance evaluation. In this post, we offer a Sharpe ratio calculator as well as explain the formula with examples.

Jump to

The Sharpe ratio formula

The Sharpe ratio takes its name from the Nobel laureate William F. Sharpe, who is among the pioneers of the widely-used capital asset pricing model. It is a reward-to-risk ratio such that it aims to capture the excess return earned per unit of risk (you can find the reference to Sharpe’s seminal paper at the bottom). The Sharpe ratio relies on the standard deviation of returns (or return volatility) as the measure of risk. And, what we mean by excess return is the return in excess of the risk-free rate. Then, the Sharpe ratio formula for a risky asset i is:

Sharpe ratio for asset i = (Return on asset i − Risk-free rate) / Standard deviation of returns on asset i

Here, the numerator represents the reward: the return earned in excess of the risk-free rate of return, which is typically based on treasury yields. And, the denominator represents the risk: the volatility of returns. In general, the higher the Sharpe ratio the better as you earn more (excess) return per unit of risk borne.

Using a bit more formal mathematical notation, we can write the Sharpe ratio formula as:

Si = (Ri − Rf) / σi

where Si is the Sharpe ratio of asset i, Ri is the return on asset i, Rf is the risk-free rate, and σi is the standard deviation of returns on asset i.

In Figure 1, we offer a visual interpretation of the Sharpe ratio in a plot of return against risk. Each point on this plot represents a risky asset, such as a stock, mutual fund, etc. And, we have the risk-free asset, which has a return of Rf, on the vertical axis.

We can connect each risky asset to the risk-free asset through a straight line. In Figure 1, we have done that for two stocks: A and B. The Sharpe ratio of stock A is simply the slope of the line that connects it to the risk-free asset: SA = (RA − Rf) / σA. The same is true for Stock B as well. And, the steeper the slope, the higher the Sharpe ratio. This means that stock B has a higher Sharpe ratio than stock A (i.e., SB > SA ).

sharpe ratio calculator formula example
Figure 1: Sharpe ratio as a reward-to-risk ratio.

Using the Sharpe ratio to evaluate performance – an example

Imagine that the average excess return a stock generated in the past 10 years was 8%. Furthermore, the volatility of returns for this stock was 30%. Let’s assume, the average excess return on the stock market index was 6% with a volatility of 20% over the same period. How did the stock perform relative to the market in the last 10 years? At first glance, the stock seems to have performed better than the market as it generated a higher excess return: 8% against 6%. However, we have to consider risk as well, and the stock’s returns were more volatile than the market returns over this period: 30% versus 20%.

We can rely on the Sharpe ratio to draw a comparison between the stock and the market index. The stock’s Sharpe ratio is:

8% / 30% = 0.27

On the other hand, the market’s Sharpe ratio is:

6% / 20% = 0.30

We can now conclude that the stock’s performance was worse than the market as its Sharpe ratio lags behind that of the market (0.27 < 0.30). This means that the stock generated less (excess) return per unit of risk compared to the market index.

Ex-ante vs ex-post Sharpe ratio

Although not frequently discussed in finance courses and textbooks, it is important to draw a distinction between the ex-ante Sharpe ratio and the ex-post Sharpe ratio. The former is a forward-looking measure and is as such based on the expected return. The latter, on the other hand, is a backward-looking measure and is calculated using past returns (a.k.a, realized returns or historical returns).

With the ex-ante Sharpe ratio, the aim is to form expectations about the reward-to-risk ratio over a future period (e.g., next year). In this case, we can write the formula more explicitly as follows:

Si = (E[Ri ]− Rf) / σi

where E[Ri ] is the expected return on asset i and σi is the expected volatility of returns for the same asset.

If our objective is to evaluate past performance, then what we are looking at is the ex-post Sharpe ratio. In particular, we have:

Si = (Ri − Rf) / si

where Ri is the realized return on asset i and si is the realized volatility of returns.

The Sharpe ratio vs the Treynor ratio

Apart from the Sharpe ratio, there are other popular risk-adjusted performance measures such as the Jensen’s alpha and the Treynor ratio. Treynor ratio, in particular, is often compared to the Sharpe ratio as they are both reward-to-risk ratios. The main difference between the two measures is based on the measure of risk. Treynor ratio, which is named after the American economist Jack Treynor, is defined as follows:

Treynor ratio for asset i = (Return on asset i − Risk-free rate) / Beta of asset i

Or, using mathematical notation:

Ti = (Ri − Rf) / βi

where Ti is the Treynor ratio of asset i, Ri is the return on asset i, Rf is the risk-free rate, and βi is the beta of asset i. Recall that the Sharpe ratio is:

Si = (Ri − Rf) / σi

So, the numerators of Sharpe ratio and Treynor ratio are the same. However, while the Sharpe ratio relies on the standard deviation of returns σi as the measure of risk, the Treynor ratio uses beta βi, which captures sensitivity to market movements. In fact, we can consider the standard deviation of returns as capturing total risk, while beta is a measure of systematic risk whereby:

Total risk = Systematic risk + Idiosyncratic risk

Therefore, the Sharpe ratio deals with (excess) return per unit of total risk, and the Treynor ratio focuses on (excess) return per unit of systematic risk. For an investor who is invested in a single stock or a few stocks only, total risk is more relevant than systematic risk as her investments would be highly exposed to unsystematic risk due to a lack of diversification. So, such investors might find the Sharpe ratio a more useful measure than the Treynor ratio.

On the other hand, another investor who holds a well-diversified portfolio would not need to worry much about unsystematic risk (also known as idiosyncratic risk) as that would be diversified away by virtue of investing a large set of assets. As a result, she may care about systematic risk only and find the Treynor ratio a more suitable reward-to-risk ratio than the Sharpe ratio.

The Sharpe ratio calculator

You need the following inputs to use our Sharpe ratio calculator:

  1. the return on the risky asset,
  2. the standard deviation of returns on the risky asset,
  3. the risk-free rate.


In this post, we offered a Sharpe ratio calculator and discussed the formula and intuition of this popular ratio. Moreover, we have highlighted the distinction between the ex-ante Sharpe ratio and the ex-post Sharpe ratio. Finally, we demonstrated how the Sharpe ratio can be used for performance evaluation and how it differs from the Treynor ratio. If you would like to learn more about this ratio, we suggest the following reading items.

Further reading on Sharpe ratio:

Sharpe (1966) ‘Mutual Fund Performance,’ The Journal of Business, Vol. 39 (1), pp. 119-138.

What is next?

This post is the final one in our free course on investments, which covers topics ranging from portfolio theory to asset pricing models. In the previous post, we studied another risk-adjusted performance measure: Jensen’s alpha. In the next post, we will be covering the Treynor ratio, which was developed around the same time as the Sharpe ratio.

If you have enjoyed reading our content, consider spreading the word on social media. If you have got questions or suggestions, you can let us know by leaving a comment below.