To expound more on that -
God says through His written word that, “the wages of sin is death” (Romans 6:23). This penalty for sin was revealed to the first human being when God warned Adam that’ “on the day that thou eat thereof thou shalt surely die” (Genesis 2:17).
Since “all have sinned…” (Romans 3:23), then we are all condemned to die.
In order for us to be free from this death penalty, Jesus Christ had to die in our stead. The penalty has to be paid, and Christ paid for it.
Jesus Christ never sinned (1 Peter 2:22) and so did not incur the death penalty. He voluntarily paid the death penalty, not for His own sin, but for ours. “But God commandeth His love toward us, in that, while we were yet sinners, Christ died for us…” (Romans 5:8-10).
The death of Jesus Christ was not in anyone’s place.
The reason why Christ’s death can pay for the penalty of the sin of all of humanity is that He is our Maker (Ephesians 3:9; John 1:1-3). The life He gave was greater than the lives of all human beings combined.