A resistor in an electrical circuit is used to limit the flow of electric current. It controls the amount of electricity that passes through it in order to prevent circuit components from being damaged by excessive current.