  We introduce $floZ$, an improved method based on normalizing flows, for
estimating the Bayesian evidence (and its numerical uncertainty) from a set of
samples drawn from the unnormalized posterior distribution. We validate it on
distributions whose evidence is known analytically, up to 15 parameter space
dimensions, and compare with two state-of-the-art techniques for estimating the
evidence: nested sampling (which computes the evidence as its main target) and
a $k$-nearest-neighbors technique that produces evidence estimates from
posterior samples. Provided representative samples from the target posterior
are available, our method is more robust to posterior distributions with sharp
features, especially in higher dimensions. For a simple multivariate Gaussian,
we demonstrate its accuracy for up to 200 dimensions with $10^5$ posterior
samples. $floZ$ has wide applicability, e.g., to estimate the evidence from
variational inference, Markov Chain Monte Carlo samples, or any other method
that delivers samples from the unnormalized posterior density, such as
simulation-based inference. We apply $floZ$ to compute the Bayes factor for the
presence of the first overtone in the ringdown signal of the gravitational wave
data of GW150914, finding good agreement with nested sampling.
