Certified GKH Gardening Expert
When you prune depends upon the type of hydrangea you have. If you have the big leaf hydrangea, its buds are developing now for next year, so pruning would cut off all next year's blooms. Many others bloom on new growth. Trim new wood bloomers in late winter or early spring to encourage growth.
Here's an article about pruning: https://www.gardeningknowhow.com/ornamental/shrubs/hydrangea/prune-hydrangea-bushes-hydrangea-pruning-instructions.htm
and here's another that explains pruning new and old wood: https://www.gardeningknowhow.com/ornamental/shrubs/shgen/pruning-old-and-new-wood.htm