# Reference for the statement that the complement of an affine open has codimension one

The following statement seems to be "well-known", but I am unable to find a reference in the standard literature. Could someone suggest a reference?

Let $X$ be a separated normal connected Noetherian scheme and $U$ a (nonempty) affine open subset. Then the complement $Y = X \smallsetminus U$ has pure codimension one.

• stacks.math.columbia.edu/tag/0BCQ provides the result you are looking for. – pbelmans Aug 25 '15 at 11:45
• EGA IV, part 4 (IHES no 32), Cor. 21.12.7. – Matthieu Romagny Aug 25 '15 at 21:43
• I'd've called this "algebraic Hartogs' theorem". If $Y$ is codimension 2 in $X$, then functions on $U$ should extend across $Y$, i.e. $U$ shouldn't be affine. – Allen Knutson Aug 31 '15 at 0:38