A wrench includes a handle, a head having a pivotal portion pivotably connected to an end of the handle, and a retaining mechanism. The pivotal portion of the head includes two end portions and an intermediate portion between the end portions. The intermediate portion includes an arcuate outer surface section that has teeth to be releasably engaged with the retaining mechanism, allowing the head to be pivotally moved to a desired position relative to the handle and retaining the head in the desired position. Thus, the thickness of the respective end portion of the pivotal portion of the head is not reduced, preventing damage to the torque-bearing section in the respective end portion of the pivotal portion during operation.