Lightning is a huge spark created by an electrical discharge. For lightning to occur, a cloud complex must contain ice crystals and hailstones. An updraft pushes the crystals to the top of the cloud, creating a positive charge. A downdraft pushes the hailstones to the bottom of the cloud, creating a negative charge. The Earth's surface has a positive charge, and during a storm, when the negative charge at the bottom of the cloud complex gets big enough and meets with the positive charge of the Earth, it creates a stepped leader.
The positive charge of the Earth attracts the stepped leader, and a positive charge of electricity moves into the air. A strong electrical current brings the positive charge up into the clouds, which is called the "return stroke," and that stroke is what is seen as lightning. Lightning balances the electrical build-up between the clouds and the ground.
When lightning hits, one stroke of it can heat the air between 15,000 to 60,000 degrees Fahrenheit. The extreme heat causes air expansion and a dramatic temperature increase, then cools quickly. The shock of the expansion creates an explosive sound wave that we know as thunder. If you see the lightning, but don't hear the thunder, it means that the lightning is so far away that the sound waves won't reach you.
You see lightning before you hear thunder because light travels faster than sound. In fact, light travels almost a million times the speed of sound. You can estimate your distance in miles from the lightning strike by counting the seconds between the lightning and thunder and dividing that by five. The longer the amount of time in between, the farther away the lightning is. When you hear a loud crack of thunder, it means the lightning is closer; when you hear the rumbling kind of thunder, don't worry, it's far away.