# How to compute dBFS?

I asked myself how to compute dBFS (dB full scale) from a value of sample between 1 and -1?

and in general?

It is really quite simple for values between 1 and -1:

valueDBFS = 20*log10(abs(value))


If you have values between another range, for example 16bit, then it's:

valueDBFS = 20*log10(abs(value)/32768)


(because 16bit signed has values between -32768 and +32767, e.g. 2^15=32768)

And so the general formula is:

valueDBFS = 20*log10(abs(value)/maxValue)


The code examples are given in MATLAB code.

• This is technically correct, but most dBFS meters actually display headroom, so you will often want to display the negative of these values. – Bjorn Roche Apr 22 '13 at 14:41
• According to the wikipedia article on full-scale, when using integers the positive value of the range is used for the max (i.e. 32767) and the maximum negative value (-32768) actually exceeds full-scale, which would mean the formula here should be 20*log10(abs(value)/32767) – paul Aug 27 '20 at 18:11

All the standards define dBFS as an RMS measurement, relative to the RMS level of a full-scale sine wave, so the calculation is:

value_dBFS = 20*log10(rms(signal) * sqrt(2)) = 20*log10(rms(signal)) + 3.0103

• A full-scale sine wave is 0 dBFS
• A full-scale square wave is +3 dBFS

The similar unit dBov is defined in relation to power ratios (so it's also an RMS measurement), such that full-scale DC or square wave is 0 dBov, so that calculation is:

value_dBov = 20*log10(rms(signal))

• A full-scale sine wave is −3 dBov
• A full-scale square wave is 0 dBov

(This definition of dBFS is explicitly designed such that the dBFS value of a full-scale sine wave equals 0 (and in consequence, that of a full-scale square wave is +3 dBFS). Since the RMS of the full-scale sine wave is 1/sqrt(2), multiplying rms(signal) by sqrt(2) ensures that the formula evaluates to 0 for the full scale sine wave: 20*log10(rms(signal) * sqrt(2)) = 20*log10((1/sqrt(2)) * sqrt(2)) = 20*log10(1) = 0.)

Relative to the RMS level of a full-scale sine wave, so the calculation is:

value_dBFS = 20*log10(rms(signal) * sqrt(2)) = 20*log10(rms(signal)) + 3.0103


Need some clarity about - > value_dBFS = 20*log10(rms(signal) * sqrt(2)) why in sin wave multiplying by sqrt(2).

The reason for the sqrt(2) in the definition of dBFS given by

value_dBFS = 20*log10(rms(signal) * sqrt(2)) = 20*log10(rms(signal)) + 3.0103


is that this definition is explicitly designed such that the dBFS value of a full-scale sine wave equals 0. Since the RMS of the full-scale sine wave is 1/sqrt(2), multiplying rms(signal) by sqrt(2) ensures that the formula evaluates to 0 when signal is a full-scale sine wave:

20*log10(rms(signal) * sqrt(2)) = 20*log10((1/sqrt(2)) * sqrt(2))
= 20*log10(1)
= 0


In the more general case where the signal is in the range [-v, v], the corresponding full-scale sine wave would be the standard sine wave multiplied by v. The RMS of this sine wave is v/sqrt(2), which implies the correction factor should be sqrt(2)/v:

value_dBFS = 20*log10(rms(signal) * sqrt(2) / v)