Money and Finance

The Efficient Frontier Explained: Building a Mean-Variance Portfolio

What the efficient frontier is, how minimum-variance and maximum-Sharpe portfolios are found, and why the weights depend so much on return estimates.

Saizul Amin
Saizul Amin7 Nov 2026 · 4 min read
The Efficient Frontier Explained: Building a Mean-Variance Portfolio

In 1952 a young economist named Harry Markowitz published a short paper that changed how professionals think about portfolios. His point was that you cannot judge an investment by its own risk and return alone. What matters is how it moves with everything else you own. Two volatile assets that zig and zag at different times can be combined into something much calmer than either. Mean-variance optimisation, and the efficient frontier it produces, is the practical form of that idea. This guide explains the concepts and shows how to explore them with the free Efficient Frontier Portfolio Optimizer.

Three inputs

The method needs three things for each asset: its expected return, its volatility (the standard deviation of returns) and its correlation with every other asset. From the volatilities and correlations you build the covariance matrix, which captures how every pair of assets moves together.

You can get these from history, by taking a few years of monthly returns and computing the averages and the sample covariance, then multiplying by 12 to put them in yearly terms. Or you can write down your own estimates, which is what most institutions do, because a few years of history make a poor guide to the next few.

Portfolio risk is not the average risk

The return of a portfolio is simply the weighted average of the asset returns. Its variance is not. It is the weights multiplied through the covariance matrix, written w′Σw. When correlations are below one, the portfolio's volatility is less than the weighted average of the individual volatilities. That gap is the benefit of diversification, and it is the reason a mix of stocks and bonds can be less risky than bonds alone in some periods.

The frontier

For every level of expected return there is one combination of the assets with the lowest possible volatility. Plot those combinations on a chart with risk across and return up, and they trace a curve bending up and to the right. That curve is the efficient frontier. Any portfolio below it is inefficient: you could get the same return for less risk, or more return for the same risk.

The leftmost point of the curve is the global minimum-variance portfolio, the least volatile mix possible. It does not depend on expected returns at all, only on the covariance matrix, which makes it one of the more robust outputs of the method.

Adding a risk-free asset

If you can also hold cash or short-term government bills at a risk-free rate, the picture changes. Draw a straight line from the risk-free rate on the vertical axis that just touches the frontier. The point where it touches is the tangency portfolio, the mix with the highest Sharpe ratio, which is excess return divided by volatility. Every point on that line, a blend of the tangency portfolio and cash, beats the frontier itself. The optimizer draws this capital allocation line as a dashed line.

Long-only or short selling

Without constraints, the mathematics often recommends selling some assets short to buy more of others. Most individual investors cannot or will not do that, so the tool defaults to long-only weights. Solving with the constraint that no weight is negative is harder, and the tool does it exactly by checking every subset of assets, which works well for up to ten.

A worked example

The tool's sample holds 36 months of illustrative returns for US stocks, international stocks, bonds, gold and REITs. Long-only, the minimum-variance portfolio is about three quarters bonds, with 12% each in US stocks and gold, giving an expected return of 8.3% and volatility of 5.1%. With a 4% risk-free rate, the maximum-Sharpe portfolio is 40% international stocks and 60% gold.

That second answer is a perfect illustration of the method's weakness. In the sample, gold and international stocks happen to have the highest averages, so the optimizer pours everything into them. Change the period by a year and the weights would look completely different.

Why the weights jump around

Mean-variance optimisation treats your expected returns as exact. In reality they are the hardest input to estimate, and small differences in them produce large swings in the weights. Practitioners deal with this in several ways: using long-run assumptions rather than recent averages, capping the weight of any asset, blending the optimised weights with a simple benchmark, or focusing on the minimum-variance end of the frontier where expected returns matter less.

The tool's estimates mode lets you test this. Enter your own expected returns, then nudge one by a percentage point and watch the maximum-Sharpe weights move.

Using the optimizer

Paste returns or prices from a spreadsheet or import a CSV, set the number of periods per year and the risk-free rate, and choose whether short selling is allowed. Read the minimum-variance and maximum-Sharpe portfolios, move the slider along the frontier to see how the weights change, and open the steps to see the means, covariance and correlation matrices behind the result. You can download the frontier, the chart or a full report. It is a learning and analysis tool, not financial advice, and past returns are no promise of future ones.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages