Zakat stands as the third pillar of Islam after testifying that there is no god but Allah and Muhammad is His final Messenger, and offering Prayer.

The Prophet (peace and blessings be upon him) is reported to have said, “Islam is built upon five pillars: testifying that there is no true god except Allah and that Muhammad is the Messenger of Allah, performing Prayer, paying the zakat, making the pilgrimage to the Sacred House (Hajj), and fasting the month of Ramadan” (Al-Bukhari).

Furthermore, It is one of the pillars of Islam, and it is a religious obligation with given characteristics, qualifications, intention, recipients, etc. It is to be paid with certain conditions, on the top of which are reaching Nisab and elapse of full lunar year.

As regards riba-based earning, it is not halal according to the view of the prominent scholars. Thus one should get rid of it. Also, it is not allowed for whoever possesses  that money to consume it in his needs.

As for a person who deposited his money in a bank that deals with riba, such person should take his money off the bank and ask Allah’s forgiveness for that. Then, the interest he gained from the bank is unlawful money for him. Thus, he should spend it in any Muslim charity organizations or give it to the poor, not on the basis of that it is zakat or sadaqah but as being money he is not allowed to consume.

In his answer to your question, Dr. Monzer Kahf, Scholar in Islamic Economics and a Financial Expert, stated,

Zakat is required only on the saved amount and the value of shares (that is the wealth item). All investments in share and the like are subject to zakat every lunar year, at the rate of 2.5%. 

A Muslim should give away earned interest to Muslim charity and he should not take interest-based loan as well because it is a sinful act.

May Allah guide all of us to what pleases Him