The range of a function f:AB is B.

Normally the range of a function is not specified, and in that case the range is usually taken to be the codomain of the function. However, this is not always the case: if the range were always the codomain, then all functions would be, by definition, surjective. It is true that every function has an equivalent function, with the range restricted to the codomain, but the mathematical definition of 'range' is different from 'codomain'. It is also true that the range is always a superset of the codomain, by necessity.

Compare with domain and codomain.