An alarm sounded around 2 a.m. at the consulate, located at 1111 Columbus Ave., according to Bernard Loesi, a spokesman for the Indonesian Consulate.
The consulate's private security guards and San Francisco police officers responded to the scene shortly after the alarm sounded.
Officers located a suspect, identified as Tobias Spencer, of North Myrtle Beach, South Carolina, inside the consulate's gates and placed him under arrest, police said.
Surveillance video footage from the consulate showed the suspect hopping the fence and breaking a window. Nothing appeared to be stolen and no one was injured, Loesi said.
Loesi said the suspect was likely under the influence of drugs and may have been searching for a warm place to spend the night.
Spencer was booked into jail on suspicion of vandalism and trespassing, police said.
The motive for the vandalism remains under investigation.