The gain selection formula given in the datasheet is included below:
Where “input signal level (dBFS) + 2.1dB” is the input signal to the amplifier in dBV. Input signal level is specified in dBFS because the input to the DAC is digital. One important thing to note is that for MAX98357A and MAX98357B, 0dBFS is referenced to 0dBV and not the full scale output of the DAC, which is 2.1dBV. To adjust for this 2.1dB difference while converting from dBFS to dBV, the input signal to the amplifier would be input signal level (dBFS) + 2.1dB.
For example, for 0dBFS input, the actual input to the amplifier would 2.1dBV. The output of the amplifier would then be 2.1dBV + the selected amplifier gain in dB.
Available gain selections are stated in Table 8 of hte datasheet as shown below. (Rev 11 5/18)