What makes a story Grimdark? Well I'm glad you asked. No problem. What makes a story Grimdark is something a lot of people tend to get wrong. I've heard various writers, readers, booktubers, and podcasters attempt to define a Grimdark Fantasy and they tend to not exactly hit the mark, so I decided to make this little guide for your pleasure. Also, while there's various genres that use this subgenre, I'm going to refer to Grimdark Fantasy in this discussion, even though this guide can be for anything Grimdark. Just a heads up. Now let's get down to it.
How I tend to describe the genre is setting, setting, setting, hard choices, plot points, setting, and hopeless/meaningless ending. That is the secret KFC recipe, and I'll explain in detail.
The most important aspect of a Grimdark story is the setting. You cannot have a Grimdark Story without a Grimdark setting. You can have the darkest, grimmest story imaginable, but if the world is 'haha wee!' then the atmosphere will not match it. This is why Warhammer is the father of Grimdark. Be it Fantasy or 40k, no matter how you slice it, it's a shitty and grim place world to live in. Even if you're a planetary governor or an elector count, sipping expensive wine and having orgies on an air conditioned patio, the world is shitty. At any moment, Tyranids, Beastmen, or Orcs(Orks) can appear out of nowhere to invade and butcher. The world is not long from ending. Your closest confidant can potentially be a demon cultist, your neighbors will usurp you, and the peasantry hate you. Even if you are rich enough to live comfortably, and that is beyond rare, it can still all come crashing down. You need a setting with impending doom from at least 4 aspects of your life in order to be Grimdark. Not potential doom, but impending doom.
Which brings me to a topic we need to discuss. People tend to think this means that Game of Thrones is Grimdark. It's not. Lord of the Rings is more Grimdark than Game of Thrones or ASOIAF. Just because they have dark plot points and the white walker threat, it does not a Grimdark Fantasy make. The White Walkers are an Impending Doom, but it's a Doom that has been able to be a nonissue for thousands of years. It's let Westeros live in ignorant bliss for millennia. There is no bliss in Grimdark. Yes, you can have optimistic characters, but not justifiably optimistic. Optimism in Grimdark is either because someone is sheltered or in denial. Hope is a scarce thing.
And as for the setting beyond that, Game of Thrones is probably less Grimdark than real world Medieval Europe. Scheming nobles and character deaths certainly help its case, but they do not create Grimdark. They're the icing on the cake certainly, but they're not the setting. Westeros is a fertile land with a stable geography, with little in the way of wars, at least for many years, until quite recently. There are very little monsters, very little constant dangers. The entire plot is dark, but it is dark because it isn't the norm of the world, even taking the various wars in its history into consideration.
Contrary to popular belief, the Lord of the Rings books are actually very close to being Grimdark. Not so much in the movies, although it is still present. If you read closely, it's pretty obvious. Middle Earth is a fallen world. It's Gods, the Valar, have all but abandoned it. The Elves are fading, the Dwarven Kingdoms have nearly all been decimated, the World of Men either serve Sauron or are in the middle of collapse. Oh, don't forget Sauron of course, who is essentially a demon-spirit who seeks to enslave every living thing in the world, with wraith knights under his control and hundreds of thousands of monsters in his army. That, coupled with the fact the roads are unguarded and waylaid by the monsters that aren't under the control of the demon spirit. It's no wonder Warhammer Fantasy claims it took inspiration from Tolkien, because they did so more than most. By and large, the only place in Middle Earth that is a fairly protected place to live is west Eriador, which leaves just the Shire, the Grey Havens, and Bree. Rivendell, Lothlorien, Minas Tirith are all now in untamed and enemy territory, which is what makes the journey of the ring so perilous. Even Aragorn says that the Breelanders live in complete sheltered ignorance, because horrors that would freeze a man's heart live just a day away from Bree that are only kept back by the tireless Dunedein Rangers. The only reason Lord of the Rings isn't Grimdark is because of its prose and Tolkien's christian propensity for hope. He does often show that while the Valar have fled, Eru still watches over the world and helps make all threads move to an eventual good. The setting of Middle Earth at least fits the Grimdark bill.
Of course, whilst it is likely the most important aspect, setting isn't everything. Let's talk characters, and we'll start with a very simple one. Do you need your main characters to be morally grey? No. It's certainly an option, but it is by no means a requirement. It's actually quite easy to have a morally light or 'good' character as a protagonist in a Grimdark story. What you need the character to be... is flawed. They need to be 'human' in the fallible sense of the word. They need this Grimdark setting they find themselves in to make them shaken, tired, perhaps even wholly disillusioned. But they do not need to be morally grey. What you need to do instead is give them hard choices. Make sure they are caught between a rock and a hard place in a bad way at least once per story, and don't give them a cop out. Should you kill the innocent little girl to save the village? Do you need the mercenary company to save the Kingdom, even if it means they decide to rape a few of the populace? If your mother is dangling by a thread, but so is your father, who will you save? You're a monk devoted to a God of forgiveness, and your family has just been killed. Do you seek vengeance? Do you try and go after them with the justification that they'll do it again if left unchecked? The list goes on. And I will add that even if your main character doesn't need to be morally grey, I would say it's required that a few side characters need to be. It's not a Grimdark setting without Grimdark people, after all. Also to note is, while it's not required, evil characters help a lot. You can have a Grimdark setting with people, villains, beings, any of them who are just reprehensible in terms of morals. It's not always needed, but moral absolutes are not necessarily a no-no in terms of Grimdark.
Plot isn't necessarily a topic that is that complicated in order to be a Grimdark story. My guideline would be, make sure your character has to compromise a lot due to circumstances and keep in mind that it's a Grimdark story, meaning things never turn out according to plan. There's going to be failure of some kind, which leads me to the piece de resistance of what is essential to create a Grimdark fantasy.
The ending. The ending is never, ever going to be a happy one. Not for your heroes or anyone else. It has to at least be bittersweet, but if you really want to be Grimdark, the ending is going to make it so all of their struggles have been, in essence, meaningless. Your protagonist is seeking to lift the curse of a Lich? By the end of the story, he might have learned a few things, gained a new magic sword, but he is still cursed and likely always will be. Or perhaps he finds himself free of the curse in death, or the death of a loved one? It cannot be a clean ending. Sunshine and rainbows are not allowed in this genre, sorry.
So, short and sweet, but there you have it folks. Your definitive guide to writing a Grimdark fantasy novel. Hope you enjoyed and keep reading!