The teen was in the bathroom at about 5:30 p.m. when someone approached him from behind, covered his mouth, and grabbed his cellphone from his pocket, according to police.
The suspect, a man in his early 20s, then fled the library, located at 2825 Diamond St. He has not been found.
The victim was not injured in the robbery.
Anyone with information about the case is encouraged to call the Police Department's anonymous tip line at (415) 575-4444 or send a tip by text message to TIP411.