Data is fitted using Python with scipy.odr, which wraps the ODRPACK module written by Paul Boggs, Richard Byrd, Janet Rogers and Robert Schnabel in the early nineties. A Python template is linked on the main page so you can try the algorithm in Python yourself. Changes to the interface, fitting behavior, and numerical results are listed in the changelog.
Exponential with Offset is the same equation formerly named Exponential. Shifted Reciprocal fits A/(x-xo)+C; avoid its pole. Saturation (Michaelis–Menten) fits V*x/(K+x). Power Law with Vertical Offset fits A*x**B+C, without a horizontal shift. X Log X fits A+B*x*log(x) and needs positive x. Hill Sigmoid (4 Parameter) fits D+(A-D)/(1+(x/C)**B); use positive x/C for a free exponent. Malus’s Law fits C+A*cos(x-phi)**2, with angles in radians.
These new models estimate blank starting values from the data using bounded candidate checks. Explicit guesses and fixed values are preserved. These estimates do not guarantee convergence or unique parameters; a narrow or nearly flat range may not constrain every parameter.
The page works best in a desktop-width window. The data table stays alone on the left; the plot and fitting controls stay on the right. The panel arrangement stays fixed. Below the minimum window width, scroll the page horizontally to reach all controls. All five parameter rows remain available. The page title is above the frame, Feedback/Template/Help/Walkthrough are beside the tabs, and Import File, the session ID, Fork and Reset are below the frame.
Custom equations accept ordinary operators and powers written with ^ or **. Pasted mathematical minus and multiplication/division symbols are normalized to supported operators. Invalid syntax is highlighted separately from an equation that cannot be evaluated at the starting values.
A one-time announcement introduces the new interface. Choose Take the walkthrough to open the guided Pearson example in a separate practice tab, or Continue fitting to use your workspace. Closing the announcement or pressing Escape also dismisses it. It does not return on reload or Reset in the same browser. A different browser or cleared browser storage may show it again.
Choose Walkthrough beside Help to open the introduction. Start practice opens a separate practice tab with Pearson’s example. The walkthrough never starts on its own during an ordinary visit. Your original draft and saved fits stay in the original tab.
The dark overlay highlights the controls for each step. Use the real controls to fit the sample, inspect residuals, evaluate the model, and export a report. Continue becomes available when an action is complete. You can go back, skip a step, choose a different chapter, or press Escape to close the overlay. Closing the overlay leaves your practice results available.
Optional chapters cover importing and pasting, uncertainty expressions, guesses and fixed values, custom equations, display scales, fit history, exports, Fork and Reset. They use a small synthetic positive-data example where appropriate; that example is teaching data, not a published validation dataset. A preparation button explains when it will start a fresh practice session. It never runs a fit or downloads a report for you.
Practice uses the same fitting and export behavior as the ordinary workspace. Allow pop-ups if a report is blocked, then click its export button again. Reloading does not automatically reopen the overlay; use Walkthrough to resume or choose another lesson. Returning to your original tab restores your access to the work you left there; practice does not replace it.
The Python used here is based on a script from University of Toronto here.
How the fit is chosen. The δx and δy buttons select one of four fitting problems:
In short, ordinary or weighted least squares is used when x uncertainties are not selected, and ODR is used whenever x uncertainties are selected, including fits with x uncertainties only. Selecting None means no measurement uncertainties are supplied to the fit; it does not mean the measurements are error-free.
What the uncertainties mean. Fit-parameter uncertainties are one standard deviation from the covariance matrix at the solution and are scaled by the square root of the reduced chi-squared (the ODR residual variance). The δx and δy you enter therefore set the relative weights of the points; the overall size of the parameter uncertainties is set by how well the model actually fits. If your uncertainties are calibrated and the reduced chi-squared is far from 1, either the model or the uncertainties are off, and the parameter uncertainties should be read with that in mind. The reduced chi-squared value is reported whenever uncertainties are supplied and is colored red when it is far from 1. Without uncertainties, R² (1 − Var(residuals)/Var(y)) is reported for models that are linear in their parameters (the polynomials, Inverse, Cauchy, and Stokes Law), and the sum of squared residuals (SSR) is reported for other models.
Warnings. "Not full rank" means at least one parameter cannot be determined separately from the others with this data and model; a free parameter whose uncertainty cannot be determined in that case is shown as n/a (in the numerical result it appears as 0), which means not estimable, not exact. "Iteration limit reached" means the solver stopped before converging, so treat the result as provisional. A fit with as many points as free parameters has zero degrees of freedom and no meaningful uncertainties. "All parameters fixed" means nothing was estimated: the model with your fixed values is plotted against the data with its residuals and goodness of fit, every uncertainty is 0 because nothing was estimated, and no confidence band is drawn. A fit that does not produce finite numbers, for example a logarithm or power law evaluated at non-positive x, is reported as an error rather than as a result.
Confidence band and calculator. The fitting solver uses derivatives analytically for the built-in models, numerically for custom equations. Confidence-band and calculator propagation use numerical derivatives of the fitted model and its parameter covariance. The plotted bands are 68.27% pointwise Student-t confidence intervals for the fitted curve: they show how uncertain the curve is, not where a new measurement would fall. A band is omitted if its covariance or Jacobian calculation is not numerically valid. The Model Evaluator reports y and its one-standard-deviation uncertainty dy at your chosen x. It combines parameter covariance with (slope * dx)^2 in the variance. A larger dx therefore has a greater effect on a steep part of the curve and little effect at a flat point; it does not include measurement scatter. Leave dx blank to use zero. This propagation is a local approximation, not a prediction interval for a new measurement.
curve.fit's regression tests combine published reference datasets with independent mathematical checks. The checks cover all four uncertainty settings:
| Uncertainties selected | Fitting method | Reference checks |
|---|---|---|
| None for both x and y | Ordinary least squares in y. | NIST reference datasets and an independent closed-form linear regression. |
| x only | Orthogonal distance regression in the exact-y limit. | Independent weighted regression of x on y, with the linear parameters and covariance transformed back to y on x. |
| y only | Weighted least squares in y. | An independent weighted linear regression, including parameter uncertainties. |
| Both x and y | Weighted orthogonal distance regression. | The Pearson–York benchmark, including an independent implementation of York's regression equations; an additional Deming-regression check of linear parameters for constant-uncertainty cases. |
Selecting None means no measurement uncertainties are supplied to the fit; it does not mean the measurements are error-free.
Open the Pearson–York example. This uses Pearson's data with York's weights, reproduced with comparison results in Cantrell (2008), Tables 1 and 2. The published weights are converted to standard deviations using sigma = 1/sqrt(weight).
With the Linear model and Table selected for both x and y uncertainties, the reference line y = m*x + b has approximately m = -0.48053 and b = 5.4799. The regression test also checks the reported parameter uncertainties, using the residual-variance scaling described under Fitting Details. Different uncertainty settings are different fitting problems and need not give the same line.
The NIST Statistical Reference Datasets collection provides published data and certified numerical reference values. curve.fit includes Norris, Pontius, Misra1a, Eckerle4, and DanWood. Each link loads a fresh editable copy with the corresponding model and settings.
The automated catalog covers 21 NIST datasets: four linear and 17 nonlinear, each with one predictor and at most five free parameters. It checks 21 starts at certified coefficients and 34 published nonlinear starts. All 55 combinations pass under both global derivative settings; this catalog uses custom expressions and therefore finite differences in both settings. The five links above are the examples exposed on the fitting page, not the full automated catalog.
Automated checks compare fitted parameters, standard errors and residual sums of squares with NIST's reference values. The current NIST check uses a relative tolerance of 1e-6, with an absolute tolerance of 1e-18. These are test tolerances, not statements of measurement accuracy.
NIST comparisons use the specified unweighted fits, with neither x nor y uncertainties supplied. They do not certify arbitrary weighted variants of those datasets. The independent linear checks above provide additional coverage for x-only, y-only, and combined uncertainty handling. Synthetic tests also exercise the built-in models in all four modes, with parameter-recovery checks for identifiable models.
Passing reference tests demonstrates agreement for the tested problems—not NIST certification of curve.fit or a guarantee for every dataset. Poorly constrained models can still yield unreliable parameter uncertainties, even when the solver reports convergence.
Additional examples: Gaussian, Gaussian Energy, and Difficult Gaussian. These are separate examples, not NIST datasets. Every example link loads a fresh copy in a new session; you can change and fit the loaded copy without changing the reference data that the next visitor receives.
This site is based on sessions that hold your data and the settings used to fit and plot it. The eight-character session ID is listed at the bottom of the page. The first visit keeps the main page URL clean; to return to a session or use it on another computer, add its ID to the end of the URL. For instance, the session with ID a08sU3fl can be opened at /a08sU3fl. You can share a generated result by copying its address from your browser.
The browser remembers the current session, so opening the main page in another tab in the same browser normally opens the same session. Use Fork when the open tabs should start with the same data but continue separately, or Reset when the new tab should start blank. The remembered session is shared by tabs in the same browser. To keep two sessions separate across a refresh, open or bookmark each tab at its explicit /SESSIONID address.
Data and fitting settings are saved when you press Fit! (the Enter key also starts the fit while the Fit! button has keyboard focus; elsewhere in the form Enter is reserved for table editing). Unsaved edits exist only in the current page and can be lost if you refresh, close the tab, or navigate elsewhere. PDF buttons open a separate tab once the report is ready; return to the original tab to continue fitting. If you deliberately navigate the fitting tab to an output address, the browser's Back button returns to it. Refreshing or reopening a saved session restores its last selected saved fit, including its table data and fitting settings.
Import File is below the frame on the left, the session ID is centered, and Fork and Reset are on the right. Previous is now a tab in the row above the plot, alongside Setup and saved fits.
You can Fork the session you're currently using if you want to keep that session, but copy the data into a new session and continue fitting.
Reset the session if you want to start fresh or if you want to retain what you have just fit for later. A new session ID will appear and you can still access the old one using the method above. If a new session cannot be created, the previous session is restored and an error message explains what happened.
The Previous tab, in the row of tabs above the plot, lists every fit completed with that session ID, each with its own fit number, model, and time. A long history is shown a page at a time, with Newer and Older controls below the list; a fit's number is its number in the session, on whichever page it appears. A fit already open in a tab says "already open" instead, and a fit that reported a warning is listed in red, as its tab is. Use Previous to load an earlier saved version's data and settings.
Copying and pasting is fully supported, but works best on Chrome and Firefox. Cells are added automatically to the table.
Comma-, tab- or semicolon-delimited files can be imported using the "Import File" button on the bottom left. Based on the number of columns in the file, the following will be assumed:
| File columns | Table interpretation |
|---|---|
| 1 | x |
| 2 | x, y |
| 3 | x, y, δy |
| 4 or more | First four columns: x, δx, y, δy |
Move values between columns with cut/copy and paste if needed. Leading header rows are skipped. Select the appropriate uncertainty mode after importing; importing an uncertainty column does not select Table for you.
Imports are limited to 1 MiB, 10,000 data rows and 256 characters per retained cell. Blank rows and leading headers do not count as data rows. A rejected or unreadable file leaves your current data unchanged.
Scientific notation, such as 1.0234e+03 or similar, is supported. Commas are supported per locales (see below).
The plot on the top right updates as you edit complete x/y rows. It displays x and y error bars when Table or Expression uncertainties are selected. You can hover over points to inspect data, or click a point to highlight the relevant row in the table. Empty and incomplete x/y rows are ignored by the preview; complete both values before fitting.
Many equations commonly used are included here, but you can enter your own by selecting Custom Equation. If you have a suggestion for a new permanent equation in the list, email Matt Wiebold.
For each model, you can enter parameters that should be fixed by checking the box next to that parameter and entering a value. To suggest starting values for the fitting algorithm, enter a starting value for that parameter, but do not check the box next to it. Fixing every parameter plots that exact model against your data instead of fitting; the report then shows residuals and the goodness of fit, and every uncertainty is 0. Parameter uncertainties are always scaled with the number of points minus the number of free parameters, whichever parameters are fixed.
Select the Custom Equation model, and use the box that appears to type in your model equation. Use the individual + and - buttons beside Parameters: to add or remove parameters, up to five (A through E). Be sure to use all the parameters you add in your equation (and don't use more than you've added). The function should include the independent variable x as well as your parameters, but y = is not necessary. Parameter names are capitalized and case-sensitive. Use Python syntax: write * for multiplication and ** for powers rather than ^. Scientific notation is supported using lowercase e, such as 2.3e-4. Note some custom formulas, particularly those with constants hard coded, may not display properly in the PDF output but will be interpreted correctly. If you need a function added and it is included in Python's numpy, email Matt Wiebold. The following functions are supported:
Be sure to select the appropriate buttons to indicate the uncertainties to use in the fit. The values entered in the table will not be used unless you select "Table" for each uncertainty.
To enter expressions, select Expression and enter a constant value or a multiplicative value as a percentage (1%) or a multiple (2x or 2*, for instance). Table uncertainty columns must contain a finite, positive value for every fitted row. The δx and δy columns are shaded when the matching button is not set to Table; their values are kept and editable but not used.
The title, x and y label fields in Plot Labels & Axes can be edited in Setup or on a saved-fit tab. They control exported reports; browser plots retain numeric ticks without title or axis-label text. Each axis has independent lin and log controls. These display changes do not rerun the fit. Residual y stays linear so signed residuals and zero remain visible.
The title, x and y label fields support LaTeX syntax by wrapping the LaTeX in dollar signs. For instance, you could write a label as:
Check out this label! $\int_0^\infty x^2 \, \mathrm{d}x$
which would appear as

Backslashes and other LaTeX special characters should not be used as plain text outside dollar signs. If a label causes an error, either remove those characters or put a valid LaTeX expression inside $...$.
Fit! runs the fit and shows the result right in the page, as a new tab beside Setup. The plot shows the data used for that fit, its fitted curve and confidence band. Data / Residuals controls are overlaid at the plot's upper right on saved fits; Setup has no such switch. The Model, Uncertainty and Plot Labels & Axes panels are below the plot, beside Parameters with the Model Evaluator underneath, and Result with warnings and export controls on the right.
The three most recent fits stay as tabs while you keep fitting; earlier ones are available from Previous. On a fit tab, the data table is greyed and read-only, with grid lines retained. Its rows belong to that saved fit: cutting, editing, pasting or undoing in Setup cannot change a completed fit's table, plot or numerical result. Return to Setup to edit its separate draft.
There is no Output row to choose from before fitting. Each fit tab offers its own outputs instead. Single PDF produces one report. Double PDF produces two side-by-side copies for a pair of lab partners. Data & Fit CSV and JSON download directly from the selected result. There is no Plot PNG button; supported existing plot-image addresses remain usable. Raw Data output and its old links are retired.
Clicking a PDF button shows a spinner at its far right until the report is ready, then opens it in a new tab. If the browser blocks the tab, a message near the export buttons asks you to allow pop-ups for this site and click the same button again. No separate ready link is required. PDF generation uses the title, labels and scales present when you clicked; subsequent edits cannot change that in-progress report.
If an export is still pending after the browser finishes waiting, click the same button to check its progress. With the same label and axis settings, this checks the existing request. Each fit permits exports for 32 distinct combinations of label and axis settings; after that, reuse settings from an earlier export or make a new fit.
For both Setup and saved results, the on-screen fit plots leave the X and Y axis labels off. Labels appear in exported reports. Built-in model equations and parameter symbols use the same static artwork in both tabs; custom equations remain text.
Presentation edits and Setup. Each fit keeps its own display settings while the page is open. Edits on the newest fit carry into Setup only for fields you have not independently edited in Setup since that fit was submitted. Clearing a field counts as an edit. Older-fit edits never carry forward, and Setup edits never change saved fits. No synchronization button is needed. Reloading restores original stored fit settings; unsaved presentation edits are not recovered. JSON includes effective display settings separately from the original inputs.
Newly generated outputs use the time zone reported by your browser. Opening an older saved output address may show a Preparing fit output page while its report is regenerated; that page refreshes automatically. This compatibility page is separate from the current PDF-button workflow.
User locale is determined via the browser, and data is interpreted accordingly. If there are no commas in the data (including the error fields and starting values), the data will use a period as the radix such that '1.000' is 1, no matter the user's locale.
If there are commas in the data, behavior depends on the locale. If en_US or similar, commas will be interpreted as thousands separators and ignored in the data. If the user has a locale with commas as the radix, they will be interpreted as such, so that '1.000' is 1e3. Note this behavior only happens if there are commas in the data. This can lead to drastically different behavior, therefore a note is included in the footer of the PDF if the user is in a locale with comma radices but none are present so the data is interpreted using period radices, or if commas are present the user's locale will be included to note how the commas were interpreted.
The error message identifies common input problems and, when possible, selects the field or table cell that needs attention. Check these items first:
x, and the supported functions listed above.For a temporary failure or a message that the fit took too long to start, your entries remain on the page. Wait a moment and press Fit! again. If the problem is with a particular input, correct it before retrying. Reset starts a new blank session, so use it only when you no longer need unsaved entries on the current page.
The table is provided by Handsontable, with support for copy and paste, as well as undo and redo.
The quick plot is provided by Plotly.
Built-in equations and parameter symbols use pre-rendered vector artwork. Custom equations remain editable text.
Fitting and plotting are done in Python using matplotlib, numpy and scipy.
PDFs are generated using LaTeX.