At anchor or made fast, the ensign should be flown from the stern staff of all boats. The U.S. national ensign has a 10:19 hoist/fly ratio.
Generally, the national ensign should be displayed at the peak of the gaff, i.e., the outer end of the spar extending aft from the mast of your boat—if you boat has a gaff. If it does not, fly it from the flagstaff at your boat's stern. If your boat has an overhanging boom or an outboard motor, your flagstaff may be offset to starboard (preferably) from your boat's centerline.
https://www.usps.org/f_stuff/etiquett.html
While the United States Flag Code, USC Title 4, Chapter 1, provides general guidelines for the display of the U.S. flag, nautical flag display is based on long-standing traditions that date back over 300 years.
The United States Power Squadrons, the worlds largest boating educational organization, developed an updated code for displaying flags on boats in 1998. This code, devised in consultation with the U.S. Coast Guard, Coast Guard Auxiliary, New York Yacht Club, and other yachting authorities, eliminates confusion and will help you show proper respect for each flag and pennant you fly.
This code is primarily for use on private vessels because small craft are so different from large ships; yet it is flexible enough to accommodate the wide variation in construction of most modern pleasure craft. The code applies to all boaters, but has specific application to members of groups such as yacht clubs, the U.S. Coast Guard Auxiliary, and the United States Power Squadrons.
While points of honor have been established by long tradition, new configurations of boats, rigging and the like have modified these points. Using antennas, fishing towers, outriggers, sailboat backstays, portside halyards, and double hoisting are all new to the flag code. Even though traditionalists may think they are incorrect, these flag display techniques are appropriate today. If your boat's configurations requires you to use any of these techniques to fly your colors, do so, but follow this code to do so correctly.