According to police, the boys had spent the night with friends, when at around 2.30am they crashed in the centre of the village.
One boy was riding a moped and the other was on a cross motorbike. Police said that the collision was violent. Both boys died at the scene and a third, also aged 17, was seriously injured and was taken to hospital in Hudiksvall. His condition was not thought to be life-threatening.
According to police in Gävleborg, all indications were that the incident was an accident.