Shaving the head (halq) is more virtuous than trimming (taqsir) for men after both Hajj and Umrah. The Prophet (peace be upon him) made supplication three times for those who shave their heads and only once for those who trim, indicating the superiority of shaving. He said: 'O Allah, forgive those who shave their heads,' and the companions said: 'And those who trim, O Messenger of Allah?' He said: 'O Allah, forgive those who shave their heads.' They repeated the question three times, and on the third occasion he added: 'And those who trim.'
Sheikh Ibn Baz stated that while both shaving and trimming are valid ways to exit the state of ihram, shaving is preferred and carries greater reward based on the Prophet's triple supplication. He recommended that men shave their heads after Hajj and after Umrah. However, if a man is performing Hajj tamattu' (Umrah followed by Hajj), it is better for him to trim after the Umrah and save the shaving for after the Hajj rites on the Day of Sacrifice, so that he has hair to shave during the greater rite.
Sheikh Al-Albani confirmed the superiority of shaving and noted that the Prophet himself shaved his head during the Farewell Hajj. He distributed his hair among the companions, who treasured it. For women, shaving the head is not permissible — they only trim a fingertip's length from the ends of their hair. This applies to women after both Hajj and Umrah without exception.