Can you repent at the moment of death and still be saved?
Yes. The thief on the cross had hours to live and nothing to offer. Jesus promised him Paradise that same day. But repentance is God's gift, not a decision a man saves for the end — and no one can tell from the bedside whether sorrow is godly or merely fear.
Yes. Scripture settles the question with a man who had hours to live and no way to prove anything.
Luke 23:40–43 (NKJV)
But the other, answering, rebuked him, saying, “Do you not even fear God, seeing you are under the same condemnation? And we indeed justly, for we receive the due reward of our deeds; but this Man has done nothing wrong.” Then he said to Jesus, “Lord, remember me when You come into Your kingdom.” And Jesus said to him, “Assuredly, I say to you, today you will be with Me in Paradise.”
Consider what this man did not have. He was never baptised. He never attended a service, never gave anything away, never made restitution to anyone he had robbed, and never lived a single day of the changed life that follows conversion. His hands were nailed down. All he could do was admit that his sentence was just, say that the Man beside him was innocent, and ask to be remembered. Jesus asked nothing further of him, and set no probation period. He promised him Paradise that same day.
So the door does not close early. But a second thing has to be said, because not every deathbed profession is a conversion, and Paul names the difference.
2 Corinthians 7:10 (NKJV)
For godly sorrow produces repentance leading to salvation, not to be regretted; but the sorrow of the world produces death.
Paul does not tell the Corinthians how the two sorrows feel. He tells them what each one produces. Godly sorrow produces repentance and ends in salvation. Worldly sorrow produces death. Both are grief over sin, and in the moment they can look identical. The difference shows in what the man does next.
That is the difficulty on a deathbed. There is no next — no following week to watch, no relapse, no life left in which the sorrow either holds or evaporates. And fear is not the disqualifier: fear of judgment is often where God begins with a person, and John the Baptist did not rebuke the crowds who came to him fleeing the wrath to come. But a man can want out of the fire without wanting the God he has spent his life avoiding, and at that bedside nobody can tell the two apart by listening. Least of all the man in the bed.
David is the clearest case, and at first he looks like an argument against everything just said. He did not come forward on his own. He concealed adultery, arranged a man's death to cover it, and carried on as king for months, and he broke only when Nathan walked into the room and confronted him. David was caught. So being caught cannot be the difference. What he grieves over is.
Psalm 51:4 (NKJV)
Against You, You only, have I sinned, and done this evil in Your sight—that You may be found just when You speak, and blameless when You judge.
David is not negotiating. He does not ask to be spared the consequences, and the consequences came, and he bore them for the rest of his life. He has stopped thinking about what the sin has done to him and started thinking about who it was against. But nobody produces that kind of grief by deciding to. So where does it come from? When the church in Jerusalem heard that Gentiles had been converted, they did not congratulate them on their sincerity.
Acts 11:18 (NKJV)
When they heard these things they became silent; and they glorified God, saying, “Then God has also granted to the Gentiles repentance to life.”
Repentance is granted. God gives it, and He can give it to a man in his last hour as easily as to a boy of twelve. That is why the thief is not a loophole in the system. He is the system working exactly as it always works — God granting a dead heart the ability to turn, in his case with minutes to spare.
This also settles what a deathbed profession is worth on its own. A man is not saved because he says the words. He is saved because Christ has taken hold of him, and a man Christ has taken hold of will say the words.
A man planning to sort out his life at the end is planning around a date he does not know, and he is assuming he will be given something Scripture calls a gift. But if you are sitting beside someone who is dying, none of the caution in this chapter is for him. Tell him about Christ. The One who granted a dying criminal repentance in his final hours has not run out of time.