What is the Hide action?
Hiding is when a character tries to be stealthy. They take an action or bonus action to take the Hide action. To do this you need a valid hiding spot where they cannot be clearly visible. Usually this means being behind a solid object, in a shadowy area, or behind mist or fog.
Varying situations have varying effectiveness for hiding. For example heavy fog makes you effectively blinded, making it hard to detect a hiding enemy. Light fog gives you disadvantage when trying to see a hiding enemy. If the rogue has total cover, then it is not possible to see them either. The best you can hope for in this situation is to be able to hear them.
Once they have a hiding place, they make a Stealth check and cannot be seen unless you beat that Stealth check with either Passive Perception or a Perception check.
If they make noise while hiding, then you can infer their location from the noise. If they attack, then you can infer their location from observing the attack.
While hiding they gain advantage on attacks, and attacks made against them first have to guess their current location, and even if they do the attack is made with disadvantage.
Hiding isn't a condition. You can't "remove hiding". You have to detect them with Perception. Even if your ally detects a hiding rogue, the best they can do is tell you their location. Even when everyone has detected the rogue, they continue hiding. Whether or not someone can see the hiding rogue is up to them.
Countering a hiding enemy
Prevent them from hiding
The simplest way to counter a hiding enemy is to prevent them from hiding. If they hide behind a box, destroy it. If they are hiding in the shadows, light a torch. If they are hiding in fog, I hope you have a way to remove fog!
Making hiding harder
If you can't destroy the box, walk around it to reduce their cover from total to 3/4, or from 3/4 to half, or half to none. If your torch doesn't illuminate them move closer so they are at least in dim light. If you can't get rid of the fog, there's not a lot you can do to make things harder.
Applying practically any condition will make it difficult if not impossible for a rogue to hide.
Get better at seeing things
5e has 4 kinds of sight:
- Normal sight: just like a normal human
- Blindsight: see in a radius, cannot be obstructed by anything
- Darkvision: see in the dark
- Truesight: like darkvision, but it works on magical darkness, you can see through illusions, invisiblity, shapechanging, and transmuted forms.
If you acquire one of these then your definition of "clearly visible" changes. If you have Darkvision then someone can't hide in the shadows. If you have Blindsight then someone can't hide behind a box.
You can also just increase your perception score. You can do this by increasing your Wisdom score, taking a class that lets you apply your proficiency bonus to perception, taking a feat to grant you bonuses to wisdom/perception.
There are also items that grant you senses, increase your skill checks, increase your wisdom, or your proficiency bonus.
You can also acquire a familiar or ally who is talented at perception.
Take actions to counter them
You can take the Search action to look for them. They won't know if you have spotted them or not, this may force them to hide again, wasting a (bonus) action, or be in a risky situation. By taking Rogue 3 the player can select the Inquisitive archetype, allowing them to Search as a bonus action.
You can also walk close to them, walk around the box they are hiding behind.
If you have a summon or familiar, then they may be able to communicate the hiding enemy's location to you if they can see them. This won't help you see the enemy, but if you know their location then you won't have to guess.
Herd them into a corner. There probably isn't infinite hiding places, the rogue will want to stay where they have advantageous terrain. Don't let them.
Place traps. A string and a bell can tell you exactly where they are. If you can restrict the rogue to an area (rig the door of a building to jam shut) then they have a huge problem.
Ready an action to counter them. When they attack or make noise their location becomes known, you can now easily fire off a spell or move towards them without concern. You can also ready an action when they try to hide. One simple counter method is to ready an action to search for the rogue if they try to hide. Sometimes it will fail, but sometimes you will immediately counter them and you can spend your whole next turn doing whatever you want.
Walk just around the corner, then ready an action to attack as soon as the rogue is in range. The curious rogue will be forced to come in to range only to be slugged in the face. You could grapple, or use a control spell instead.
Remove their advantages
A hiding rogue gains advantage. This can be removed easily by giving them disadvantage. If you drop prone attacks against you from more than 5ft away have disadvantage. You can also move in to cover, into fog, into shadows, etc, just the way the rogue does.
You can also gain total cover yourself, preventing any attack. Just stand behind a box or a tree yourself.
Don't fight them in a dense forest. Disengage, run, escape. Fight them in an open plain where they can't hide.
Ignore their advantages
You can still attack them and target them with spells, you just have to guess their location and you have disadvantage. There is plenty you can do against a hidden target without ever doing anything to counter their ability to hide.
Fire AoE attacks, accept that sometimes you will miss and fire targeted attacks. The most frustrating thing for a rogue is to see all their handwork gone to waste because the enemy simply doesn't care.
Dictate the fight
A rogue is at its best when they can fight in an environment with tons of hiding places, a situation where they have advantage to hiding and you have disadvantage to perception.
However, other classes can have their strengths too. A twisting maze of sharp corners is a rogue's nightmare, but a barbarian will excel at chasing down and pummeling the rogue. An open field will give a ranger the clear line of sight and distance they need to eliminate a rogue before they can do anything.
Think about the class you are playing, and what your ideal engagement looks like. Only fight the rogue if the conditions are right. Otherwise, disengage, escape, run. Fight another day.
You can also put the rogue on the back foot, even in their ideal terrain. Be the aggressor and force them to react to you. Once a fighter has a grapple on the rogue, or a wizard lands a control spell, the rogue will be scrambling to react. Keep on the offensive and force the rogue to spend their actions reacting to you instead of playing cat and mouse like they would love.
Ultimately, hiding isn't that strong
Every class has counters, and even someone without a class can use ready, search, and has the autonomy to move around. Remember that the rogue has to plan a lot, engineer the situation a lot, and do a lot, to remain effective. The rogue is probably using their move, bonus action, and action. They are doing everything they can to function. They can be easily countered by dozens of strategies.
Don't let the rogue win by fighting smart, when you are fighting dumb.