Experience

Summary
Experience is a numeric value based off of performing a variety of different activies in game such as completing buildings. The more experience you earn the higher your level becomes.

Your level and current amount of experience gained toward the next level is displayed on the upper left hand corner of your screen. Your level is also displayed next to your name in clan chat and global chat.

How Experience Relates to Level
As you gain experience, your level increases. At each new level, the amount of experience you need to advance to next level increases by 50.

Given an arbitrary level, the following formula can be used to determine how much experience is required to advance to the next level:  Level * 50 - 50

For example if you are level 87, you need (87 * 50) - 50 = 4,300 additional experience to become level 88.

If you wish to calculate the total amount of experience someone has earned, use the following formula:

Level * (Level - 1) / 2 * 50

For example to reach level 87, you need 87 * 86 / 2 * 50 = 187,050 experience.

How Experience is Earned
In Clash of Clans you earn experience from the following methods:
 * Donating troops.
 * Building and upgrading structures.
 * Completing achievements.
 * Destroying an opponent's town hall.
 * Clearing obstacles.

Donating Troops
When donating troops to your clan mates, you get 1 experience point per troop slot donated. For instance, if you donate a barbarian, you get one experience point because it fills one troop slot. If you donate a P.E.K.K.A you will get 25 experience points because it fills 25 troop slots.