The minimum depth for a fence post of any height in stable soil is 2 feet. Loose or unstable soils may require more depth in order to support the fence and keep it sturdy. Concrete may be required to anchor the post in some soils or code jurisdictions regardless of post depth.
The One-Third Rule
Bury at least one-third of the post height as a good rule of thumb for wooden fence post depth. For example, one-third of a 6-foot-high fence is 2 feet; therefore, the minimum depth for a 6-foot-high fence is 2 feet. Taller fences need deeper posts.
Frost below a fence post will push up on it, causing it to move, tilt or possibly fall over. The colder the climate, the deeper the frost line will be. Dig holes for fence posts at least 6-inches deeper than the frost line.
Many building departments have codes for minimum post depth on fences and other posts set in the ground. They may also require permits and specify fence construction methods. Consult your building department for fence post depths and permit requirements.