Best for · Web hosting
How to host a web page on OneDrive: why it shows code, and the free ways that actually work
- Last checked
- 6 sources, linked below
- By the vectaai team
We read every plan page. Paid links are labelled. Money never changes a ranking. How we pick.
Verdict Our pick
The bar guide has a call.

- You cannot really host a web page on OneDrive.
Compared here
- 01Share a zip from OneDrive
- 02Embed a OneDrive file in a page
- 03Netlify Drop
- 04GitHub Pages
- 05Cloudflare Pages
- 06Cheap paid hosting
Short answer
You cannot really host a web page on OneDrive. OneDrive stores and shares files; it is not a web server. When someone opens your shared index.html, they get the file to download or the raw code, not a working page, which is exactly what users report on Microsoft's own Q&A forum. Old tricks that used OneDrive as a web host stopped working years ago.
What works instead: if you just need a colleague to see the page, zip the folder and share the zip from OneDrive; they unzip and open it locally. If you want a real public link, use a free static host: drag the folder onto Netlify Drop, publish from GitHub Pages (free, 1 GB site limit, soft 100 GB a month bandwidth, not for running an online business) or Cloudflare Pages (500 builds a month and 20,000 files on the free plan). And if you want a OneDrive document or picture to appear on your existing site, OneDrive's Embed option gives you the HTML code. Facts from Microsoft, GitHub, Cloudflare and Netlify pages, read 4 December 2026.
Sponsored links. We may earn a commission; it never changes the pick.
At a glance
| Option | Cost | What you get | Limits to know | Best for |
|---|---|---|---|---|
| Share a zip from OneDrive | Free with OneDrive | Recipient downloads, unzips, opens locally | Not a public web page | Showing a draft to one person |
| OneDrive Embed | Free with OneDrive | HTML code to show a OneDrive file or picture on your own site | Needs a website already; viewers do not sign in | Putting a document on a page |
| Netlify Drop | Free to start | Drag a folder, get a live preview URL | Under 50 MB works best; files over 10 MB may get stuck; claim it with an account | Fastest public link |
| GitHub Pages | Free | Static site from a repository, github.io or custom domain | 1 GB site, soft 100 GB a month, not for online businesses | Personal and project pages |
| Cloudflare Pages | Free plan | Static site hosting | 500 builds a month, 20,000 files, 25 MiB per file | Fast, many custom domains |
| Cheap web hosting | Paid | Full hosting with email, PHP, databases | Renewal prices higher than intro | Business sites |
No money on the free options here: Netlify, GitHub and Cloudflare do not pay us. The one paid link, to Hostinger, goes through /go/hostinger and may earn us a commission; it is there for people who outgrow free hosting. Facts come from Microsoft, GitHub, Cloudflare and Netlify pages, read 4 December 2026.
Why OneDrive shows code instead of your page
You built a page: index.html, a CSS file, a few images. You put the folder in OneDrive, share the link, and your friend sees a download prompt or a wall of code. That is not you doing it wrong.
A web page needs a web server: software that answers a browser's request with the file plus a label saying "this is a web page, render it", and that serves the CSS and images at matching addresses. OneDrive is file storage. Its share links hand over files for viewing or downloading. They do not run your folder as a website.
The Microsoft Q&A thread on exactly this question has the community answer in plain words: "OneDrive isn't a web server and doesn't honor the HTML codes that a browser and server exchange with each other." The accepted answer was to zip the files and share the zip.
You will find older blog posts showing OneDrive or Google Drive as a free web host. Those features and the third-party bridges built on them have come and gone; do not build anything you care about on a trick that relies on a storage service behaving like a server.
What OneDrive can do for you
1. Share the page for someone to open locally
If one person needs to see a draft:
- Put the whole folder (index.html, CSS, images, scripts) into a zip file.
- Upload the zip to OneDrive and share the link.
- They download it, unzip it and double-click index.html. It opens in their browser from their own computer.
Fine for a review. Not a website.
2. Embed a OneDrive file into a page you already host
If you have a website and want a OneDrive document, spreadsheet or photo to appear on it, OneDrive has a built-in option. From Microsoft's embed help page:
- Sign in at onedrive.com.
- Go to Files view and find the file.
- Select it, click the more (...) icon and choose Embed.
- Select Generate and copy the HTML into your page.
Microsoft notes that "Anyone who visits the webpage with this embedded file will be able to view it without signing in", so do not embed anything private. If an embed later shows "This item won't load right now", the file or link changed; re-embed it. The page is written for personal OneDrive; work and school accounts are pointed to their IT helpdesk.
Free ways to actually host your page
Netlify Drop: the fastest
Netlify's docs describe it as simply as it works: go to the drag and drop publisher, "drag your project folder to the Deploy zone. Your web project will go live with a unique preview URL."
What to know:
- Drag the folder that holds your HTML, CSS and JS (often called dist, build or public if you used a tool).
- "Deploys under 50MB work best, and individual files over 10MB may cause your deploy to get stuck."
- If you drop without logging in, Netlify "publishes the files as-is". Log in to keep the site, name it and let Netlify build projects that need a build step.
- To update, drag the new folder onto the site's Deploys page.
For someone who searched "host a web page OneDrive", this is the closest thing to what they hoped OneDrive would do.
GitHub Pages: free and long-lived
GitHub Pages is "a static site hosting service" that publishes straight from a GitHub repository, on a github.io address or your own domain. You get one user site per account and one project site per repository.
The limits page is short:
- Published sites "may be no larger than 1 GB"; source repositories have a recommended 1 GB limit.
- "Soft bandwidth limit of 100 GB per month."
- Soft limit of 10 builds an hour (not for custom GitHub Actions workflows).
- Deployments time out after 10 minutes.
- Not allowed "to be used as a free web-hosting service to run your online business", and not for sending passwords or card numbers.
Simple path: create a repository, upload your files through the web interface, then turn on Pages in the repository settings. Good for portfolios, project pages, documentation and class work.
Cloudflare Pages: generous free plan
Cloudflare's Pages limits for the free plan: 500 builds a month (one at a time), up to 20,000 files per site, 25 MiB max per file, and 100 custom domains per project. Good if you expect real traffic or want your own domain on a fast network.
When to pay for hosting instead
Free static hosts serve HTML, CSS, JavaScript and images. They do not give you:
- Email at your domain.
- PHP, WordPress or a database.
- A support line when something breaks before a launch.
- Permission to run a business (GitHub Pages forbids it outright).
If any of those matter, cheap shared hosting costs a few dollars a month. Watch the renewal price, which is usually much higher than the intro. Our best cheap web hosting roundup compares intro and renewal prices, web hosting free trials covers money-back windows, and if you are new to the terms, start with what a web hosting server is. Hostinger is one common cheap starting point.
Quick decision guide
| You want to... | Do this |
|---|---|
| Show a draft to one person | Zip it, share from OneDrive |
| Put a Word doc or photo on your existing site | OneDrive Embed |
| Get a public link in two minutes | Netlify Drop |
| Keep a free portfolio or project page for years | GitHub Pages |
| Host a static site with your domain and real traffic | Cloudflare Pages |
| Run a business site with email or WordPress | Paid hosting |
If you wanted OneDrive for privacy, not hosting
Some people try OneDrive because they want files under their control, not a public website. If that is you, a website is the wrong tool. Look at self-hosted cloud storage instead, or keep using OneDrive's sharing with specific people and expiry dates.
Questions people ask
Can OneDrive host a website?
No. OneDrive is file storage, not a web server. A shared HTML file opens as a download or as code, not as a running page, as users describe on Microsoft's Q&A forum. Microsoft's own OneDrive help covers embedding files in a web page you already host, not hosting the page itself. Use a static host for that.
Why does my HTML file show code when shared from OneDrive?
Because OneDrive sends the file as a file. A web server sends it with instructions that tell the browser to render it as a page, and OneDrive's sharing link does not do that for your HTML. The page's CSS and images also live at addresses the browser cannot follow. Zip it for one person, or use a static host.
What is the easiest free way to host a single HTML page?
Netlify Drop: drag your project folder onto the drop zone and Netlify publishes it with a preview URL. Its docs say deploys under 50 MB work best, and if you drop without logging in it publishes the files as they are. Sign up to keep and name the site. GitHub Pages is free too but needs a repository.
Can I embed a OneDrive file in my website?
Yes. Sign in at onedrive.com, find the file, click the more icon, choose Embed and select Generate to get HTML you paste into your page. Microsoft says anyone visiting that page can view the file without signing in. It works for photos, Office documents and other files, but your website itself must be hosted somewhere else.
Can I host a website on SharePoint or Google Drive instead?
Not as a normal public website. SharePoint is for intranet pages inside a company, and Google Drive, like OneDrive, is file storage rather than a web host. Workarounds you find online, like renaming files to .aspx in SharePoint, are unofficial and fragile. A free static host is simpler and gives you a clean public address.
Sources
Every fact above comes from these pages. Prices change, so each one carries the date we read it.
- Microsoft Q&A: Uploading html file to share (OneDrive), checked 4 Dec 2026
- Microsoft support: Embed a OneDrive document or picture in a webpage, checked 4 Dec 2026
- GitHub Docs: About GitHub Pages, checked 4 Dec 2026
- GitHub Docs: GitHub Pages limits, checked 4 Dec 2026
- Cloudflare Pages limits, checked 4 Dec 2026
- Netlify docs: Deploy, drag and drop publisher, checked 4 Dec 2026