We present a technique to fit the stellar components of the Galaxy by comparing Hess Diagrams (HDs) generated from trilegal models to real data. We apply this technique, which we call mwfitting, to photometric data from the first 3 yr of the Dark Energy Survey (DES). After removing regions containing known resolved stellar systems such as globular clusters, dwarf galaxies, nearby galaxies, the Large Magellanic Cloud, and the Sagittarius Stream, our main sample spans a total area of ∼2300 deg2. We further explore a smaller subset (∼1300 deg2) that excludes all regions with known stellar streams and stellar overdensities. Validation tests on synthetic data possessing similar properties to the DES data show that the method is able to recover input parameters with a precision better than 3 per cent. We fit the DES data with an exponential thick disc model and an oblate double power-law halo model. We find that the best-fitting thick disc model has radial and vertical scale heights of 2.67 ± 0.09 kpc and 925 ± 40 pc, respectively. The stellar halo is fit with a broken power-law density profile with an oblateness of 0.75 ± 0.01, an inner index of 1.82 ± 0.08, an outer index of 4.14 ± 0.05, and a break at 18.52 ± 0.27 kpc from the Galactic centre. Several previously discovered stellar overdensities are recovered in the residual stellar density map, showing the reliability of mwfitting in determining the Galactic components. Simulations made with the best-fitting parameters are a promising way to predict Milky Way star counts for surveys such as the LSST and Euclid.