I call this a $40 headboard because that's about what it cost in lumber and supplies.
Step 1: Start with a plan
As you can see from the crude drawing in the photo, my plans didn't require drafting nor computer skills. I sketched out the measurements for the headboard, which for this particular bed (queen size) turned out to be 64" wide, and the headboard 30" inches tall, and sitting on 25" "legs." The holes for attaching to the bed frame were 58.5" between the centers of the slots.
I actually made the headboard 31.5" tall, since that's the width of 9 1x4's stacked together, but my daughter still hasn't noticed!