From the Super Mario Wiki
Star Bits are collectible and most common items in Super Mario Galaxy and Super Mario Galaxy 2. For every 50 (Super Mario Galaxy) or 100 (Super Mario Galaxy 2) Mario collects, he receives an Extra Life. If Mario loses a life while in a stage, his coins will disappear when he respawns, but his Star Bit count will remain the same. After completing a mission, Mario's Star Bits are added to his total amount. The stored Star Bits are then used to feed the Hungry Lumas found in the Comet Observatory and several galaxies to unlock galaxies and planets, respectively, or at various points in the different Worlds and to spin Chance Cubes on Starship Mario in Super Mario Galaxy 2. They can also be used to feed all other Lumas, without any gain.
Star Bits come in many colors (red, yellow, green, blue, purple, and white), and are quite shiny. They are first introduced when Mario arrives at Princess Peach's Castle at the beginning of the game, in the form of small rocks from space landing and releasing them. To collect them, the player can move the Star Cursor over them or simply run up to them.
When Mario flies through space from a planet to another planet, Star Bits often appear around him. To get them, the player must act quick and touch each of them with the Star Cursor before Mario lands on the next planet.
Pressing the button will shoot a Star Bit at the Star Cursor. This can be used to stun or defeat enemies. However, After the Star Bits have been fired, they cannot be recovered because this will deduct from the player's Star Bit total.
The average enemy, such as a Goomba, will expel three Star Bits when defeated. However, that will only happen if the Star Spin is used, as simply jumping on one produces a single Coin. This holds true for most, but not all enemies. For example Magikoopas only release Coins no matter what method they are defeated by.
Mario can also make Star Bits appear by Ground Pounding certain buttons or activating Flipswitches in various galaxies. Note that this will not always happen, as each button or Flipswitch performs a different function depending on its galaxy and location.
There is a larger object thought to be somewhat related to Star Bits called the Star Crystal, many of which are normally seen in Launch Star paths. They are broken upon impact and produce at least six Star Bits that Mario must collect quickly before they fly away.
Other Game Appearances
Mario & Sonic at the Olympic Winter Games
Super Mario 3D World
Names in Other Languages