Most pious devotions in the Catholic Church, such as the Rosary, have a biblical basis, but are not word-for-word found in the Bible.
The Divine Mercy devotion is another example of a devotion that has deep biblical roots, but was privately revealed to a saint after the Bible was composed.
Divine Mercy in the Old Testament
Some readings of the Bible can give the idea that somewhere between the Old and New Testament, God switched from being a vengeful God to a loving God. There is even an ancient heresy called Marcionism that states the God of the Old Testament was a tyrant or demiurge, distinctly separate from the God of the New Testament, who is loving, kind and merciful:
In this way, mercy is in a certain sense contrasted with God’s justice, and in many cases is shown to be not only more powerful than that justice but also more profound. Even the Old Testament teaches that, although justice is an authentic virtue in man, and in God signifies transcendent perfection, nevertheless love is greater than justice: greater in the sense that it is primary and fundamental. Love, so to speak, conditions justice and, in the final analysis, justice serves love. The primacy and superiority of love vis-a-vis justice – this is a mark of the whole of revelation – are revealed precisely through mercy. This seemed so obvious to the psalmists and prophets that the very term justice ended up by meaning the salvation accomplished by the Lord and His mercy.
Divine Mercy in the New Testament
A basic pillar of the Divine Mercy devotion is a belief that God wants us to be merciful, as he is merciful to us.
Jesus repeatedly taught his disciples using such terms.
Blessed are the merciful, for they shall obtain mercy.
Matthew 5:7
Go and learn what this means, “I desire mercy, and not sacrifice.” For I came not to call the righteous, but sinners.
Matthew 9:13
Also, the Divine Mercy image was inspired by the following passage from the Bible:
[O]ne of the soldiers pierced his side with a spear, and at once there came out blood and water.
John 19:34
Many of the other elements of the Divine Mercy devotion are not directly found in the Bible, but in the private revelations to St. Faustina, who claimed to have received various messages from Jesus himself.