How can I calculate the stock volatility in percentage? Do i have to use sd() function without any other calculation ?



4 Answers 4


You're looking for the standard deviation of log returns, appropriately annualized and converted to percentage (i.e. multiplied by 100).

Here is an example of computing annual vol from daily prices:

data <- get.hist.quote('VOD.L')
price <- data$Close
ret <- log(lag(price)) - log(price)
vol <- sd(ret) * sqrt(250) * 100


  1. The above code should really be using prices adjusted for corporate actions (dividends, splits etc).
  2. 250 is the (approximate) number of trading days in a year.
  • 1
    $\begingroup$ A suggested editor notes that if you have NAs in ret, the last line won't work unless you use sd(ret, na.rm=TRUE). $\endgroup$ Sep 23, 2018 at 17:24

When volatility is described as a percentage, that means it's being given as a fraction of the mean. So if the standard deviation of the price is 10 and the mean is 100, then the price could be described as 10% volatile.

In R terms, this would mean:

vol_percent = sd(price) / mean(price)

EDIT: This could also have been easily found on the Wikipedia article for volatility.

  • 3
    $\begingroup$ Re the edit: Your answer disagrees with the Wikipedia article: "The annualized volatility σ is the standard deviation of the instrument's yearly logarithmic returns." That's the value appearing in the Block-Scholes and other stochastic models. Multiply it by 100 to express it in percent. $\endgroup$
    – whuber
    Aug 25, 2011 at 19:09
  • $\begingroup$ Huh. The definition I was familiar with was the one from the introduction: "Volatility is normally expressed in annualized terms, and it may either be an absolute number ($5) or a fraction of the mean (5%)." I'm not a finance guy by any means, though, so if you or someone else wants to give a more thorough answer then that would be welcome. $\endgroup$
    – bnaul
    Aug 25, 2011 at 19:30
  • $\begingroup$ whuber : Wikipedia isn't always definitive. Whether to use Black-Scholes or non logarithmic approaches depends on what you seek from your analysis. You are correct in that the logarithmic approach is the accepted norm however a major weakness of the logarithmic method is it assumes constant values for volatility, thereby doesn't consider variations in volatility over time. The original poster of the question wasn't clear on what "type" of volatility is sought. In reality a logarithmic method or a mean sd/based method are valid. $\endgroup$
    – Tomm P
    Nov 23, 2021 at 8:30

BNaul's answer is probably not the one you're looking for. If you want to calculate Black-Scholes style volatility, you need to calculate an annualized volatility of log-returns. That means, calculate the log return series $\ln(s_t/s_{t-1})$ for each $t$, take the standard deviation, and then adjust it by the square root of time to obtain the annualized figure. This volatility can be used in pricing models that require Black Scholes vol.


The stock return volatility is not observable, we can only estimate it. I'm assuming that you mean historical volatility, because there's also implied volatility which is estimated from options on stocks.

There are several ways of estimating it. For instance, look at this paper "MEASURING HISTORICAL VOLATILITY". Start with the simplest method, which they call "Close-to-close", it's similar to Classical method in Bloomberg terminal ("CLV"). It's always a good idea to check your results against Bloomberg. If you have access to the terminal, then get the document describing how they do it exactly.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.