Before removing the old fill valve, you'll want to purchase a replacement part that matches. If you know the model number of toilet you have, you can potentially find a replacement that way.
A running toilet ... old fill valve: Unscrew the water supply line and loosen the lock nut holding the valve in place. Install the new valve: Follow the instructions provided with your replacement ...