When you are exercising or working hard, it's important to stay hydrated to replace those all-important electrolytes you lose when you sweat. But it can be difficult to know how much water your body needs at any given time. That's about to change thanks to a new wearable "sweat patch" that uses your perspiration to help you understand exactly what's going on inside your body.

Think of it like a FitBit but with a level of data unlike anything you have seen before. The new skin patch was developed by John Rogers, director of Northwestern University’s Center for Bio-Integrated Electronics, and uses the biochemical components in sweat to let you know you're getting dehydrated before you notice any physical sensations. It is roughly the same size and thickness as a quarter, but it is soft and flexible and will adhere to skin through even the sweatiest workouts.

According to Rogers and his team, the sweat patch also can be used to pinpoint levels of electrolytes such as chloride, glucose and lactate. Various components on the patch change colors depending upon hydration and electrolyte levels, and an app on your smartphone can analyze those colors to decode your sweat.

Watch Rogers explain how the sweat patch works in this video:

And Rogers sees applications for the skin patch outside of the fitness world. With additional tweaking, researchers think the patch may be able to provide early diagnoses for diseases such as diabetes or cystic fibrosis.

"Sweat is a rich, chemical broth containing a number of important chemical compounds with physiological health information," said Rogers in a press release.

To test the skin patch, Rogers and his team had athletes wear both the skin patch and absorbent pads that were taped to the body and then sent to a lab for analysis. One group of athletes cycled indoors under controlled conditions. A second group wore the patch and pads during the El Tour de Tucson, a long-distance bicycle race in hot and rapidly changing conditions.

In both cases, the skin patch stayed on the athletes throughout their entire period of exercise. And according to the study published in the journal Science Translational Medicine, the biochemical markers from the skin patch matched those from the sweat analyzed later in the lab.