Both shaving (الحلق) and trimming (التقصير) are valid for men, but shaving is clearly preferred. النبي (صلى الله عليه وسلم) prayed three times for those who shave their heads and once for those who trim, when the companions asked about the virtue of each. Shaving involves removing all hair from the head, while trimming means cutting at least a fingertip's length (approximately 2 cm) from all areas of the hair — not just the tips.
For women, shaving is NOT permitted. Women perform التقصير only — gathering their hair and cutting approximately a fingertip's length from the ends. This applies regardless of hair length or style. A woman who shaves her head would be going against the السنة.
In the الحج ritual sequence on the 10th of ذو الحجة, the shaving/trimming comes after the stoning of الجمرات al-Aqabah and the animal sacrifice (for those who must sacrifice). Once you shave or trim, you enter the first stage of exiting الإحرام (التحلل al-awal): everything that was prohibited during الإحرام becomes جائز again EXCEPT sexual relations with your spouse. After performing الطواف al-Ifadah and السعي, you enter the second stage of التحلل (التحلل al-thani), and all restrictions are lifted. Barber services are widely available in منى and مكة — many الحجاج use the free or low-cost barber services near the الجمرات area.