He has now left the party after being caught last February sending 270 messages to a 16 year old boy.
He resigned as government minister after the scandal and was undergoing disciplinary action from the SNP.
The process was currently on hold to allow Mr Mackay to get help for mental health problems.
A spokesman for the party said: “Derek Mackay has resigned his membership of the SNP, bringing the matter to a close.
“As was widely reported last year, Mr Mackay was receiving mental health support, and as a result disciplinary action was paused.
“We wish him well for his recovery.”
Despite quitting from the SNP, Mr Mackay could still run as an independent in his constituency in the upcoming May elections.
Police Scotland did not pursue criminal charges and said at the time "there is nothing to suggest that an offence has been committed"