On the cross, Jesus exchanged our sin for His perfect righteousness. This means that we are made righteous in the sight of God; that is, that we are accepted as righteous and treated as righteous by God on account of what the Lord Jesus has done. He was made sin; we are made righteousness. On the cross, Jesus was treated as if He were a sinner, though He was perfectly holy and pure. We are treated as if we were righteous, though we are defiled and depraved. Because of what Jesus endured on our behalf, we are treated as if we have entirely fulfilled the Law of God and have never become exposed to its penalty. We have received this precious gift of righteousness from the God of all mercy and grace. To Him be the glory!
God made him who had no sin to be sin for us, so that in him we might become the righteousness of God. 2 Corinthians 5:21