This video will provide you a tutorial on when to rebuild or reorganize a SQL Index. If an index is fragmented greater than 35% then you will want to rebuild else if it is between 5% and 35% then you will want to reorganize the index.
Github Script:
https://github.com/ProfessorPitch/ProfessorPitch/tree/master/SQL/Indexes
Microsoft Documentation:
https://docs.microsoft.com/en-us/sql/relational-databases/indexes/reorganize-and-rebuild-indexes?view=sql-server-2017