Let R be a standard graded algebra over a field. We investigate how the singularities of Spec R or Proj R affect the h-vector of R, which is the coefficients of the numerator of its Hilbert series. The most concrete consequence of our work asserts that if R satisfies Serre's condition (S r ) and have reasonable singularities (Du Bois on the punctured spectrum or F -pure), then h 0 , . . . , h r ≥ 0. Furthermore the multiplicity of R is at leastWe also prove that equality in many cases forces R to be Cohen-Macaulay. The main technical tools are sharp bounds on regularity of certain Ext modules, which can be viewed as Kodaira-type vanishing statements for Du Bois and F -pure singularities. Many corollaries are deduced, for instance that nice singularities of small codimension must be Cohen-Macaulay. Our results build on and extend previous work by de Fernex-Ein, Eisenbud-Goto, Huneke-Smith, Murai-Terai and others.