Codomain and range of onto Functions

Is the codomain and range of an onto function the same? As far as I understand, if $$f:A\to B$$, range is all possible values in B. So if it's an onto function, then all values in B must be mapped to something in A right? Am I correct?

Yes, by definition a function $$f:A\to B$$ is onto if the range ($$f(A)$$) equals the codomain ($$B$$).
I'm not sure you wrote what you meant to write. All values in $$B$$ must be mapped to by something in $$A$$, yes.