The geometry of thermodynamic state space is studied for asymptotically anti-de Sitter black holes in D-dimensional space-times. Convexity of thermodynamic potentials and the analytic structure of the response functions is analyzed. The thermodynamic potentials can be used to define a metric on the space of thermodynamic variables, and two commonly used such metrics are the Weinhold metric, derived from the internal energy, and the Ruppeiner metric, derived from the entropy. The intrinsic curvature of these metrics is calculated for charged and for rotating black holes, and it is shown that the curvature diverges when heat capacities diverge but, contrary to general expectations, the singularities in the Ricci scalars do not reflect the critical behavior. When a cosmological constant is included as a state space variable, it can be interpreted as a pressure and the thermodynamically conjugate variable as a thermodynamic volume. The geometry of the resulting extended thermodynamic state space is also studied, in the context of rotating black holes, and there are curvature singularities when the heat capacity at constant angular velocity diverges and when the black hole is incompressible. Again the critical behavior is not visible in the singularities of the thermodynamic Ricci scalar.