The boy had used text from a song to express that he would kill himself and take others with him at his former school. Administrators at the school discovered the plot on Thursday and alerted police, who arrested the boy in his home.
Despite having been banned from the school for severe behavioural problems six months ago, the boy had turned up soon before his arrest, making a scene and vandalising school property, police said.
The former student admitted to writing the forum post during police interrogation. He has since been transferred to state psychiatric care while police investigate the incident.
Germany is particularly sensitive to school violence after 17-year-old Tim Kretschmer killed 15 people at his former school with his father's gun in the southwestern German town of Winnenden in March. He later killed himself during a shootout with police.
The massacre stirred up debate about stronger whether the country needs stronger gun laws or a ban on violent video games.