The economic surplus (also known as the total welfare or social surplus) of an activity or transaction is (roughly) defined as the total value added by that activity to all members of society who are affected by that activity. This includes those who are directly involved in the activity, as well as other parties who may be indirectly affected.
In the absence of any external costs and external benefits (i.e., costs and benefits that accrue to parties not directly involved with the transaction) the economic surplus is the sum of the surpluses for all parties directly involved in the transaction.
The typical transaction for which economic surplus is measured is a purchase of a good from a seller by a buyer. In this case, the economic surplus is the sum of the producer surplus (the value added for the seller) and the consumer surplus (the value added for the buyer).