Green hydrogen may decarbonize sectors which are difficult to electrify, and the recent Inflation Reduction Act (IRA) provides tax credits to encourage hydrogen production. We analyze a model in which hydrogen produced using electricity replaces natural gas. The electricity may be procured from dedicated renewables or from the grid with and without offsetting. In the absence of Pigouvian taxation, optimal hydrogen subsidies are positive if the unpriced externality from avoided natural gas is larger than the unpriced externality from electricity. With optimally differentiated subsidies, offsetting increases welfare. With undifferentiated subsidies, offsetting can decrease welfare, unless it is restricted to regions with higher unpriced electricity externalities. Short-run parameterization shows that the IRA‘s subsidy of $3/kg-H2 is rationalized: i) by hydrogen production from dedicated renewables if the social cost of carbon (SCC) is $500 or ii) by hydrogen production from the (relatively clean) grid in California with renewables offsetting (relatively dirty) electricity in the non-RGGI East if the SCC is $185. Allowing offsetting of production in California with renewables in any region does not reduce welfare, but the reverse does not hold.