Scott Falconer, 20, Bruce Owens, 19, and Cameron Henry, 17, spray-painted comments including "brotherhood" and "white power" on headstones in the Necropolis in Glasgow.
Gardeners found the vandalism when they turned up for work and spotted the graffiti, which included phrases and swastikas drawn on headstones and some that had been toppled and broken.
The damage to 18 headstones , which had been broken or defaced, totalled £40,000.
The police were contacted and, after receiving an anonymous email with pictures attached showing the accused at work, they investigated through Facebook and tracked the three men down.
Falconer, from Kilbarchan in Renfrewshire and Henry, from Carluke in North Lanarkshire, pleaded guilty at Glasgow Sheriff Court to spray-painting racist slogans on various headstones between July 15 and July 17, 2011.
Owens, from Cranhill in Glasgow, admitted the same offence as well as kicking over and damaging headstones.
Procurator fiscal depute Derek Buchanan told the court how two gardeners went to the grounds on July 17 to start their shift at 9am.
He said: "They saw there was damage to various headstones and property and three headstones in the graveyard had been spray-painted with black paint.
"One headstone displayed the words 'white power', the second had 'dubba' and the third headstone had 'punks dead ha'.
"The three headstones had swastikas spray-painted on them."
In another area of the graveyard the gardeners saw phrases, including "FT n******" and "1488" (a racist code), sprayed on other headstones, and some had been kicked over and damaged.
The police were called to the cemetery and took note of the damage.
The court was told that 10 days later police received an anonymous email with photographs showing people at the Necropolis linking them to the case. The photos were circulated and Owens was identified.
Further investigations through Facebook, Mr Buchanan added, identified Henry and Falconer.
During his police interview in December 2011, Falconer admitted being responsible for spray-painting "brotherhood" and "1488" on headstones.
The court heard Owens did not admit having anything to do with the vandalism when questioned by police, despite a comment he had posted on his Facebook wall "indicative of his involvement".
Henry was the last to be arrested in December 2011.
Mr Buchanan said: "Mr Henry admitted to knowing about the damage caused and knowing who was responsible. He said he saw himself and his friends as fascists and stated that he hated immigrants.
"The accused was shown one photograph in which Mr Henry identified himself as being present."
He admitted spray-painting the phrase "punks dead ha" on one of the headstones.
Sheriff Alayne Swanson deferred sentence on all men until next month and bail was continued.