Definition
This idiom is used to indicate that if a criticism or accusation is applicable to someone, then that person should accept it.
"If the cap fits, wear it," she remarked, implying he was being overly sensitive to the accusation.
When he was criticized for being late, he simply said, "If the cap fits, I'll wear it."
The comment was clearly directed at you, so if the cap fits, you have to accept it.