The conventional theory of decision confidence suggests that confidence reflects the probability that a decision is correct—the posterior probability of the chosen option. However, due to factors including inference noise and incorrect generative models, the brain is incapable of computing exact posteriors. We propose a new model of decision confidence by assuming that the brain possesses an internal generative model of these imperfections, which we describe as “true posteriors plus noise”. Using this generative model, the brain performs “meta-inference”, by computing confidence as the probability that the chosen option (whose noisy posterior is the highest) also has the highest true posterior. In other words, we propose that confidence reflects the probability that the observer made the best possible decision under the noisy posteriors. We found that this model outperformed the conventional model in explaining confidence in multiple-alternative perceptual decisions, and it quantitatively accounts for empirical confidence ratings in value-based decisions.