Determine the size of the planter box. It is best to use pressure-treated wood or cedar.
Cut the side and end pieces to the size you want. Then fasten them together using galvanized screws. Measure the box's inside length and width. Cut a piece to fit in the bottom. Secure the bottom through the sides with galvanized screws.
Attach cleats to the bottom of the box. This will give you a nice profile and keep the box from damaging the railing over time.
Drill three or four drainage holes in the bottom of the box.
Cut a piece of vinyl or nylon screen to fit into the bottom of the box. The screen will help hold gravel and dirt in the box.
You can screw the box directly to your deck railing. Another option is to use a store-bought bracket system that attaches to the side of the railing.