Skip to content

Home / Tools / Sharpe ratio calculator

Sharpe ratio calculator

By Sitraka Forler · Lecturer, Durham Business SchoolUpdated 16 October 2026 About this site

The Sharpe ratio is excess return per unit of volatility; the Sortino ratio is excess return per unit of downside risk only. Paste a series of returns to get both, annualised from daily, weekly, monthly or quarterly data, or enter an annual mean and volatility for a quick Sharpe.

Free, no sign-up. Everything is computed in your browser: nothing you type is sent anywhere. Educational tool, not investment advice.

1. Calculator

Start from

Paste a column from a spreadsheet, or separate values with commas, spaces or new lines. Simple returns, oldest first.

Values are in

Sets the annualisation: return × P, volatility × √P.

Divided by 12 for the per-month hurdle.

Sortino target
Table 1. Sharpe and Sortino ratios of 6 monthly returns, annualised with P = 12.
MeasureValueUnit
Observations6months
Mean return per month1.000%
Volatility per month (sample, n − 1)4.050%
Downside deviation per month2.380%
Annualised return12.00% a year
Annualised volatility14.03% a year
Sharpe ratio, per month0.2469ratio
Sharpe ratio, annualised0.8554ratio
Sortino ratio, per month0.4201ratio
Sortino ratio, annualised1.4552ratio

6 observations is a short record: a ratio this young has a wide margin of error, so treat it as an illustration.

2. The formulas

Sharpe  = (R̄ − R_f) / σ
Equation 1. Sharpe ratio (Sharpe, 1994): mean excess return over its standard deviation.
Sortino = (R̄ − T) / σ_d
σ_d     = √( (1/N) · Σ min(R_t − T, 0)² )
Equation 2. Sortino ratio: the same numerator over downside deviation, with target T.
Sharpe_annual = Sharpe_period × √P
Equation 3. Annualising from P periods a year (252 trading days, 52 weeks, 12 months).

R̄ is the mean return per period, R_f the risk-free rate for the same period (the annual rate divided by P), σ the sample standard deviation of returns (divisor N − 1, as pandas computes it) and N the number of periods. Mean return grows with P and volatility only with √P, so the ratio grows with √P: that is why a daily and an annual Sharpe of the same strategy are different numbers.

Downside deviation squares only the shortfalls below the target, but averages them over all N periods. Taking the standard deviation of the losing periods alone is a common mistake that can more than double the ratio; the Sortino ratio page works through why.

3. Worked example

  1. Six monthly returns: +4%, −3%, +3%, −5%, +5%, +2%, with a risk-free rate of 0. The mean is 6 / 6 = 1.0% a month.
  2. Deviations from the mean are 3, −4, 2, −6, 4 and 1; their squares sum to 82. Sample variance = 82 / 5 = 16.4, so σ = √16.4 = 4.049691% a month.
  3. Monthly Sharpe = 1.0 / 4.049691 = 0.246932, so 0.2469. Annualised: 0.246932 × √12 = 0.246932 × 3.464102 = 0.8554.
  4. Shortfalls below the target of 0 are −3 and −5 (the four gains count as 0). Squares: 9 + 25 = 34; averaged over all six months, 34 / 6 = 5.666667, so σ_d = 2.380476%.
  5. Monthly Sortino = 1.0 / 2.380476 = 0.420084, so 0.4201. Annualised: 0.420084 × 3.464102 = 1.4552.

Sortino (1.4552) is well above Sharpe (0.8554) because four of the six months are gains: Sharpe counts their swings as risk, Sortino does not. Load the example in the calculator above to see the same figures.

4. The Python behind it

import numpy as np

r = np.array([4, -3, 3, -5, 5, 2]) / 100   # monthly returns, as decimals
rf, P = 0.00, 12                            # annual risk-free rate, periods a year

excess = r - rf / P
sharpe = excess.mean() / r.std(ddof=1) * np.sqrt(P)

# Downside deviation: squared shortfalls below the target, averaged over ALL periods
downside = np.sqrt(np.mean(np.minimum(excess, 0) ** 2))
sortino = excess.mean() / downside * np.sqrt(P)

print(f"Sharpe {sharpe:.4f}, Sortino {sortino:.4f}")   # Sharpe 0.8554, Sortino 1.4552
Listing 1. The same calculation in NumPy; it prints the numbers of the worked example.

5. Reading the result

  • Above 1 is generally read as good and above 2 as very good, for an annualised Sharpe on several years of data. A short record (the six months above) gives a ratio with a wide margin of error.
  • State the frequency and the risk-free rate beside the number: two Sharpes are comparable only when both match.
  • √P assumes returns are independent from one period to the next. Trending or clustered returns break that and usually flatter the annualised figure.
  • Neither ratio sees the shape of the tail. Strategies that sell insurance can post a high Sharpe for years; read the maximum drawdown alongside.

Learn the concept

  • Sharpe Ratio: Risk-adjusted return: excess return divided by volatility.
  • Sortino Ratio: Like Sharpe, but penalises only downside volatility.

Code it yourself, free, in your browser

More: all calculators · every formula on one page