A search for resonances and quantum black holes is performed using the dijet mass spectra measured in proton-proton collisions at root s = 8 TeV with the CMS detector at the LHC. The data set corresponds to an integrated luminosity of 19.7 fb(-1). In a search for narrow resonances that couple to quark-quark, quark-gluon, or gluon-gluon pairs, model-independent upper limits, at 95% confidence level, are obtained on the production cross section of resonances, with masses above 1.2 TeV. When interpreted in the context of specific models the limits exclude string resonances with masses below 5.0 TeV; excited quarks below 3.5 TeV; scalar diquarks below 4.7 TeV; W' bosons below 1.9 TeV or between 2.0 and 2.2 TeV; Z' bosons below 1.7 TeV; and Randall-Sundrum gravitons below 1.6 TeV. A separate search is conducted for narrow resonances that decay to final states including b quarks. The first exclusion limit is set for excited b quarks, with a lower mass limit between 1.2 and 1.6 TeV depending on their decay properties. Searches are also carried out for wide resonances, assuming for the first time width-to-mass ratios up to 30%, and for quantum black holes with a range of model parameters. The wide resonance search excludes axigluons and colorons with mass below 3.6 TeV, and color-octet scalars with mass below 2.5 TeV. Lower bounds between 5.0 and 6.3 TeV are set on the masses of quantum black holes.