Settling Kahn's conjecture (2001), we prove the following upper bound on the number i(G) of independent sets in a graph G without isolated vertices:where du is the degree of vertex u in G. Equality occurs when G is a disjoint union of complete bipartite graphs. The inequality was previously proved for regular graphs by Kahn and Zhao.We also prove an analogous tight lower bound:where equality occurs for G a disjoint union of cliques. More generally, we prove bounds on the weighted versions of these quantities, i.e., the independent set polynomial, or equivalently the partition function of the hard-core model with a given fugacity on a graph.