A search is presented for charged Higgs bosons in the decay mode in the hadronic final state and in final states with an electron or muon. The search is based on proton-proton collision data recorded by the CMS experiment in 2016 at a center-of-mass energy of 13 TeV, corresponding to an integrated luminosity of 35.9 fb. The results agree with the background expectation from the standard model. Upper limits at 95% confidence level are set on the production cross section times branching fraction to for an in the mass range of 80 GeV to 3 TeV, including the region near the top quark mass. The observed limit ranges from 6 pb at 80 GeV to 5 fb at 3 TeV. The limits are interpreted in the context of the minimal supersymmetric standard model scenario.