Sources of Competitive Advantage

Moats tend to come from a relatively small number of sources:
Cost advantage — the ability to produce goods or services more cheaply than competitors. This can stem from scale economies, proprietary processes, or advantageous geography. The lowest-cost producer in a commodity industry can sustain profitability that rivals cannot match.
Switching costs — when changing providers is painful (financially, operationally, or psychologically), customers stay put even if a competitor offers marginally better terms. Enterprise software companies are the classic example: once a business has integrated a vendor's systems into its operations, switching is enormously expensive.
Network effects — a product or service that becomes more valuable as more people use it. Payment networks, social platforms, and marketplaces all benefit from network effects: Visa is more useful because everyone accepts it; a marketplace is more valuable with more buyers and sellers.
Intangible assets — brands, patents, licences, and regulatory approvals that competitors cannot easily replicate. A pharmaceutical company's patent on a blockbuster drug is a moat; so is a consumer brand that commands a price premium through trust and loyalty.
Efficient scale — in markets where a single or small number of suppliers can serve the entire demand without incentivising new entry (local utilities, for example), incumbent operators can earn sustained returns without facing meaningful competition.