A bill to allow unauthorized immigrants to gain citizenship carries electoral risks and rewards for the Republican Party. On the one hand, if the bill were passed, some of those immigrants would eventually vote. Roughly 80 percent of illegal immigrants are Hispanic, and about 10 percent are Asian — groups that voted heavily Democratic in the last two elections.

On the other hand, such legislation could plausibly improve the Republican Party’s brand image among Hispanics and Asian-Americans, perhaps allowing the party to fare better among these voters in future elections. Which of these effects would outweigh the other?

The answer is not necessarily obvious. As Harry J. Enten of The Guardian points out, such immigration reform is unlikely to create an electoral “bonanza” for Democrats, as some faulty attempts to analyze the question have concluded. But whether the legislation could be net-beneficial to the Republican Party depends on the assumptions you make.

So, I’ve designed a tool, in the form of an interactive graphic, that allows you to make different sets of assumptions about immigration reform, population growth and racial voting patterns. Although the graphic contains a number of simplifications, we hope it will be useful to experiment with.

The graphic begins with 2012 voting results as a baseline. In each state, and the District of Columbia, I’ve estimated the vote for Barack Obama and Mitt Romney in the five racial categories (white, black, Hispanic, Asian and “other”) that are tracked in exit polls.

Because the exit poll data is incomplete — 19 states did not have exit polls last year, and the polls often did not break down the results where a racial population was small (for instance, Asian-Americans in Montana) — I had to rely on various forms of extrapolation and interpolation to fill in the missing data points. My research suggests, for example, that the share of the Hispanic vote going to Mr. Obama in each state was modestly correlated with the share of the white vote he won in those states, while his share of the vote among African-Americans and Asian-Americans was not correlated with the white vote and instead was relatively constant from state to state.

The estimates are slightly more speculative in states where no exit polling was conducted in 2012. But because a complete set of exit polls were conducted in 2008, it was reasonably easy to extrapolate the results forward based on the overall shift in the vote in each state from 2008 to 2012, and the changes in national voting patterns among the different racial groups. The estimates are calibrated, however, so that the whole matches the sum of the parts: if you add up the estimated voting results among the five racial groups in each state, the results should exactly match the overall vote totals for Mr. Obama and Mr. Romney last year.

The interactive graphic then allows you to make three sets of assumptions to consider how the vote might change going forward.

Step 1: Population Growth

Immigration reform is being contested against a background of an increasingly nonwhite electorate. Seventy-two percent of voters were white in 2012, down from 74 percent in 2008 and 81 percent in 2000.

The graphic allows you to consider the effects of further population changes by entering growth rates for the five major racial groups. As a default, it assumes that the number of white voters will grow by 0.5 percent a year, the number of black voters by 1 percent a year, the number of Hispanic and “other” voters by 3 percent a year and the number of Asian voters by 3.5 percent a year. These figures represent a rough consensus of various population growth estimates.

Note that these changes are measured on an annual basis, rather than per election cycle, and that the changes will compound over time. If the number of Hispanic voters grows at 3 percent a year, for example, the total increase in Hispanic voters would be 12 to 13 percent by 2016.

The graphic also allows you to select the year in which the hypothetical election would be contested — population growth will have a larger impact the further you go out in time. (As a default, I’ve chosen 2028, which would be the first presidential election after the proposed 13-year path to citizenship.)

The calculation assumes that the growth rate among each racial population will be the same in each state — that is, if the Hispanic population grows by 3 percent a year nationally, it will grow by 3 percent a year in California, by 3 percent a year in Alabama, and so forth. However, because fast-growing racial groups represent a larger share of the population in some states, these states may grow faster over all. The graphic will automatically reapportion electoral votes based on these population growth estimates. (We may introduce the ability to make more sophisticated assumptions about population changes in future versions of the analysis.)

Step 2: Unauthorized Immigrants

The graphic also allows you to consider the effects of legislation that would introduce new citizens to the electorate. These changes are assumed to have a one-time effect: that is, they would affect the status of the roughly 11 million unauthorized immigrants who are already in the United States, but not future groups of immigrants. The calculation assumes that this impact is separate from the long-term changes in the voter population evaluated in the previous step.

The graphic requires you to estimate what percentage of that 11 million would become citizens under the new legislation, and what percentage of those new citizens would vote. Based on the research cited by Mr. Enten, we use 50 percent as a default value in each case. That is, half the unauthorized immigrants would become citizens, and half of those new citizens would vote, meaning that 25 percent of unauthorized immigrants would eventually become voters. But these assumptions can be changed.

You can also choose how to allocate the new citizens among the five racial categories. A majority of immigrants here illegally are Hispanic, but not all of them are. Instead, based on a variety of sources, I estimate that 80 percent are Hispanic, 11 percent Asian, 5 percent white, 2 percent black and 2 percent other races. The graphic assumes that once these immigrants became citizens, they would vote Democratic or Republican in the same proportions as other members of their racial group.

Step 3: Changes to Racial Voting Patterns

Finally, the graphic allows you to evaluate the effects of changes in the share of votes going to each party from each racial group. The changes are assumed to be uniform across states. So, for example, if your assumption is that the G.O.P. does five percentage points better with Hispanics nationally than it did in 2012, the Republican share of the Hispanic vote is assumed to grow to 44 percent from 39 percent in Florida, to 23 percent from 18 percent in Illinois, and so forth.

Note that the graphic can be used to evaluate the effects of any of these three steps independent of the others. For instance, if you are interested in seeing how the G.O.P. might have done in 2012 had it performed significantly better among Hispanics, but without considering the effects of population growth or immigration reform, you can set the election year to 2012 and zero out the values for the number of illegal immigrants who would become citizens.

One Potential Scenario

The most interesting application, however, is in seeing how the various positive and negative effects for Republicans might play out against one another.

Suppose, for example, that the voter population grows in accordance with the defaults assumed in the model. This would produce a net of 6.3 million new votes for Democrats by 2028.

And suppose that 25 percent of the immigrants currently here illegally gain citizenship and vote by 2028. The model calculates that this would provide another 1.2 million votes for Democrats.

But suppose also that, as a result of immigration reform, the Republicans go from winning about 28 percent of the Hispanic vote and 24 percent of the Asian vote (as they did in 2012) to 35 percent of each group by 2028. That would shift about 4.8 million votes back to the G.O.P. — about four times more than it lost from the immigrants becoming citizens and voting predominantly Democratic. However, it wouldn’t be enough to outweigh the Democratic gains from long-term population growth.

Different assumptions, naturally, will yield different results. In general, however, you should find that population growth and changes in racial voting patterns will have much larger effects than how the current group of unauthorized immigrants is treated.

The high-stakes question, in other words, is whether immigration reform would really allow Republicans to improve their vote share substantially among Hispanics and Asians, without costing them too many votes among white voters. If so, that is where the electoral “bonanza” might lie.