Advice for first time DM

Have some pre-made encounters, NPCs, etc, basically like pulling them out of a bag. Use your storytelling to spin them together.

One other tip, if your players are new you gotta hook them on the rp side of DnD and I had tremendous success in my villain. a well hated villain can be all the motivation they need to really invest in a quest. In my campaign it took the form of Trivigogg, a high level elven mage who is ostensibly on the same quest, but simply levitated up the mountain they're adventuring up. Since then he's been sending illusions of himself to shittalk the party

>Let me guess, you must be a warlock. Is reading a tome just too hard for you or did you take it up on a dare?

>WOOOOOW a whole seven goblins. Look at you, savior of... This rock.

>Listen, you look like you're putting a lot of effort into climbing this wall but I just want you to know its all for naught and I am eating a dee-licious roast right now.

Our rogue botches and sinks his dagger into his own thigh, the words 'Smooth move tree-humper' echo faintly down the cavern.

If they don't desire something enough, make them hate something enough. The line above made my rogue call a cig break so he could furiously plan his 4th level abilities.

Its the little things that make DMing worthwhile. Hours of work and a swollen writing wrist, but you spend the whole time going "Maannnnn I hope they think this is as clever as I do"

THE HORNED

RAAAAAAAAAAAAAAAAAAAAAAAT!

Watch-learn, man-thing!

youtube.com/watch?v=KxTaQmhztVQ

Pic related. Prepare things (names/places/encounters/etc.), but don't be beholden to them. Giving players freedom will inevitably go off the tracks, so build broad concepts with wiggle room instead of a master plan.

Ask yourself and the players questions. Get to know the world you're building, and criticize yourself to see if it holds up. If you find something confusing or farfetched, the players will be way ahead of you. And asking players questions reminds them of their agency and gets creative juices flowing.

Shoot for verisimilitude. Don't be realistic, be "realistic". Nobody's asking you to deconstruct the setting, but it should be internally consistent.

Try to avoid saying 'no' when possible and use 'yes, but...'. Players ought to make their decisions, and while you can certainly nudge them in the right direction their choice is their choice. Right or wrong, clever or stupid. When doing combats/checks/dialogue, let players describe what they do, and try to make failures entertaining instead of a straight shutdown.

...

...

Pretty much what everyone else has said. Have some story threads, encounters, and characters ready to go if the PC's run into them. But also be prepared for them to miss all that, and you end up having to improvise something.

A good example I have of this is from a Star Wards d20 campaign I ran. The group were tasked with hunting a rancor, in order to give it as tribute to a Hutt crime boss. They had a Steve Irwin inspired hunter NPC with them. During combat, he (meaning me) consistently failed his rolls and was generally shit. The PC's started to suspect he wasn't 100% on the level. Obviously in my plans he was exactly who he said he was, I just had bad rolls. But I liked their theorising, and decided to change the plot I'd come up with to make it so he was impersonator, actually an Imperial assassin who was trying to get the party killed in the wilderness on this mission.

Also, make sure you know what skills/DC you are going to set for any challenges/skill checks you characters have to make, and be consistent with them. There's always that one dick who says "ohhhh but 3 weeks ago it was only a DC15 to do blah blah blah".

"Yep, a DC15 sounds about right for then. But This week it's a DC20. Might want to look into why."

Yeah. Sandbox is terrible. Everybody says they want it but it always turns into a huge disaster because first they lose the thread then they get bored then they do stupid stuff in pursuit of amusement. "Off the wall" is just admitting defeat early.

Have a loose plot outline on hand so that you'll always have an answer for "what should they do next" and don't be afraid to advance it via a sudden event if the game is starting to bog down.

Once that spine is in place sprinkle other plots, characters, and activities around it and see what catches their interest. As long as they're bouncing around the setting doing things and having fun let them run with it, when it bogs down go ahead and advance the main plot.

Pretentious as it sounds, think of yourself as a musician. It's great if you can take requests but if someone doesn't have one ready don't just sit there and wait until someone asks for a song you know. Just play *something.*

And like musicians keep giving each other something to build on. "Literally doing whatever they want" isn't free-form, it's just noise.

Every single first time DM I've met (myself included) has tried to run a sandbox where "you can do ANYTHING!"

This is a bad idea. Sandboxes don't work in tabletop like they do in video games. Preparing one quest is difficult for newbie DMs and trying to make multiple quests that your party might not even see? Really hard.

Tabletop games by their very nature are games where you can do anything. That doesn't mean you should do everything. Prepare one or two really solid quests and be prepared to pull shit out of your ass when the players go on crazy tangents. The best DMs aren't the most prepared but the most flexible, malleable, and good at improve.