MDF for shelf support?

I’ve decided to put an extra shelf in the wasted space in my bedroom closet. The closet is 4 feet wide. The plan was to screw a piece of pine 1x4 onto each of the side walls for the shelf to rest on, and put a metal support bracket in the middle. Something like this, but I’m only putting wood on the sides, not along the back. The shelf itself is melamine.

I was able to get everything I need delivered, except for the 1x4. For some stupid reason Home Depot and Lowes will only do “truck” delivery, and wanted to charge like $80 to deliver a single piece of wood. Ok, whatever. So this morning I ran down to Home Depot. In my haste to get in and out, I stupidly didn’t pay attention to the board I bought - I just grabbed the shortest primed 1x4 I saw. When I got home, I realized it’s MDF board, not pine.

Will that work? Will MDF provide enough support for the shelf? I don’t imagine I’ll be putting hundreds of pounds of stuff on this shelf. Or should I go back and buy real wood?

The MDF will be perfectly fine–especially if you put a bead of adhesive caulk behind it. If you’re hand nailing or screwing, pre-drill.

MDF has very little strength, but in this application it’s not really being stressed much at all. If it were being used for the shelf itself I’d be very concerned, but just as a support where it’s firmly screwed to the wall it should be ok. Make sure the screws go into the wall studs (which warning would apply no matter what the material was). Also make sure the center support is attached to a stud.

MDF has very little structural quality to it. any torsional stress against the screw and it will break apart. If kids use it as a ladder it will fail. Otherwise it will outlast you. the worst that can happen is it breaks someday and you end up buying a piece of pine.

I’m surprised you can’t buy it at a lumber store. they’re considered essential in my state.