This answer spells out the actual calculation of performance rating for USCF tournaments, as in the June 2017 Rating Estimator that Fred Knight's answer points to. If you view the page source at that link, the calculation is given in the form of the code for the
Aside from details about whether one has an established rating and such, the basic calculation that it performs for an established player is as follows:
When a player with rating
playerRating takes on an opponent whose rating is
opponentRating, her expected score for the game is given by the formula
1 / (10^(opponentRating - playerRating) / 400) + 1), which will be a number between 0 and 1.
performanceRating function makes a guess at the
playerRating, and sums up the results from step 1 across all the games entered for the player. That sum is the total score a player with that rating would be expected to get against the listed opponents.
Depending on whether the total expected score from step 2 is higher or lower than the player's actual tournament score as entered in the estimator, the
performanceRating function iteratively adjusts its guess up or down as needed until it narrows in on the
playerRating value that yields an expected score that matches the actual tournament score. That is then the player's performance rating for the tournament.
In case anyone wants something less opaque than the estimator's source code, here is a Google sheet that allows one to enter opponent ratings and total tournament score as in the USCF estimator, and then iteratively guess performance ratings manually. You should find that the performance rating result matches that of the estimator (again, at least in an ordinary situation not among the various exceptions that the estimator's
performanceRating function deals with).