Deploy HTML and Next.js Sites to Netlify
Deploy to Netlify by dragging a folder for HTML sites or connecting Git for Next.js and React. Build settings, forms without a backend, and free plan basics.
By UndieGravity, , 1 min read
Netlify hosts static sites and full framework apps, and it has the easiest deploy of all for plain HTML: drag a folder into the browser. Here is how to deploy each kind of template.
HTML template: drag and drop
- Sign up at netlify.com.
- Open the Netlify Drop page from your dashboard (Add new project, Deploy manually).
- Drag your template folder, the one containing
index.html, onto the page.
Your site is live in seconds on a netlify.app address. To update it, drag the changed folder again. For regular updates, use Git instead (below).
React or Next.js: connect Git
- Push your project to GitHub, GitLab, or Bitbucket.
- In Netlify choose Add new project, Import an existing project and pick the repository.
- Check the build settings Netlify detects.
- Add environment variables, then deploy.
Build settings by project type
- Vite (React): build command
npm run build, publish directorydist. - Next.js: build command
npm run build; Netlify detects Next.js and configures the rest with its adapter, which supports server rendering, route handlers, and images. - Static Next.js export: build command
npm run build, publish directoryout.
Netlify's Next.js adapter is developed in the open as part of the OpenNext project and updates automatically unless you pin a version.
Single page apps need one redirect
A React app with client-side routing returns 404 when someone refreshes on /about, because no about.html exists. Add a _redirects file to the publish folder:
/* /index.html 200Contact forms without a backend
Netlify Forms collects submissions from plain HTML forms. Add a data-netlify="true" attribute and a name, and submissions appear in your Netlify dashboard.
<form name="contact" method="POST" data-netlify="true">
<input type="hidden" name="form-name" value="contact">
<label>Email <input type="email" name="email" required></label>
<label>Message <textarea name="message" required></textarea></label>
<button type="submit">Send</button>
</form>Free plan basics
Netlify's free plan uses a monthly credit allowance shared by builds, bandwidth, and other features, and it allows commercial sites. When the credits run out, projects pause until the next cycle rather than charging you. Check Netlify's pricing page for the current numbers.