We present a Bayesian method to determine simultaneously the age, metallicity, distance modulus, and interstellar reddening by dust of any resolved stellar population, by comparing the observed and synthetic color magnitude diagrams on a star by star basis, with no need to bin the data into a carefully selected magnitude grid. We test the method with mock stellar populations, and show that it works correctly even for scarce stellar populations with only one or two hundred stars above the main sequence turn off. If the population is the result of two star formation bursts, we can infer the contribution of each event to the total stellar population. The code works automatically and has already been used to study massive amounts of Magellanic clouds photometric data. In this paper we analyze in detail three Large Magellanic Cloud star clusters and 6 Ultra Faint Dwarf Galaxies. For these galaxies we recover physical parameters in agreement with those quoted in the literature, age $\sim13.7$ Gyr and a very low metallicity $log\,Z\sim-4$. Searching for multiple populations in these galaxies, we find, at a very low significance level, signs of a double stellar population for Ursa Major I: a dominant old population and a younger one which contributes $\sim25$% of the stars, in agreement with independent results from other authors.