Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:3:129

And to Allah belongs whatever is in the heavens and whatever is on the earth. He forgives whom He wills and punishes whom He wills. And Allah is Forgiving and Merciful.  

To God belongs all that is in the heavens and the earth, as possessions, creatures and servants; He forgives whom He wills, forgiveness for, and chastises whom He wills, chastisement for. And God is Forgiving, of His friends, Merciful, to those who obey Him.
القرآن:٣:١٢٩

وَلِلَّهِ مَا فِي السَّمَاوَاتِ وَمَا فِي الْأَرْضِ ۚ يَغْفِرُ لِمَنْ يَشَاءُ وَيُعَذِّبُ مَنْ يَشَاءُ ۚ وَاللَّهُ غَفُورٌ رَحِيمٌ  

{ولله ما في السماوات وما في الأرض} ملكا وخلقا وعبيدا {يغفر لمن يشاء} المغفرة له {ويعذب من يشاء} تعذيبه {والله غفور} لأوليائه {رحيم} بأهل طاعته.

See similar narrations below:

Collected by Qurʾān
quran:48:14

And to Allah belongs the dominion of the heavens and the earth. He forgives whom He wills and punishes whom He wills. And ever is Allah Forgiving and Merciful.  

And to God belongs the kingdom of the heavens and the earth: He forgives whomever He will and chastises whomever He will; and God is ever Forgiving, Merciful, that is to say, He is ever possessed of the attributes mentioned.
القرآن:٤٨:١٤

وَلِلَّهِ مُلْكُ السَّمَاوَاتِ وَالْأَرْضِ ۚ يَغْفِرُ لِمَنْ يَشَاءُ وَيُعَذِّبُ مَنْ يَشَاءُ ۚ وَكَانَ اللَّهُ غَفُورًا رَحِيمًا  

{ولله ملك السماوات والأرض يغفر لمن يشاء ويعذِّب من يشاء وكان الله غفورا رحيما} أي لم يزل متصفا بما ذكر.