A search for a charged Higgs boson is performed with a data sample corresponding to an integrated luminosity of 19.7 ± 0.5 fb−1 collected with the CMS detector in proton-proton collisions at √s= 8,TeV. The charged Higgs boson is searched for in top quark decays for mH± < mt − mb, and in the direct production pp → t(b)H± for mH± > mt − mb. The H± → τ±ντ and H± → tb decay modes in the final states τh+jets, μτh, ℓ+jets, and ℓℓ’ (ℓ =e, μ) are considered in the search. No signal is observed and 95% confidence level upper limits are set on the charged Higgs boson production. A model-independent upper limit on the product branching fraction (Formula presented.) is obtained in the mass range mH± = 80–160 GeV, while the upper limit on the cross section times branching fraction (Formula presented.) is set in the mass range mH+ = 180–600 GeV. Here, σ(pp → t(b)H±) stands for the cross section sum (Formula presented.), an upper limit on σ(pp → t(b)H±) of 2.0–0.13 pb is set for mH± = 180–600 GeV. The combination of all considered decay modes and final states is used to set exclusion limits in the mH±−tan β parameter space in differe ... mehrnt MSSM benchmark scenarios. © 2015, The Author(s).