What copying a website means and when to do it
Copying a website means downloading the HTML, CSS, images, and other files from a live website to your computer so you can view it offline or study how it was built. This is different from cloning a repository on GitHub — you are grabbing the rendered files a browser sees, not the source code a developer wrote.
You might copy a website to view it without an internet connection, to preserve a page before it changes, to learn how a particular layout or feature works, or to use as a starting template for your own project. The legality depends on the site's terms of service and copyright — copying for personal study is generally permitted, but republishing or selling copied content is not.
There are several methods, each suited to different situations. Some are one-click operations; others require command-line tools. The right choice depends on how much of the site you need, whether you want to keep links working, and how comfortable you are with technical steps.
Key Takeaways
- Browser developer tools let you save a single page as HTML and assets in seconds, but only capture what loads on that one page.
- Dedicated download tools like Wget and HTTrack can copy entire websites recursively, preserving folder structure and internal links.
- Saving as a single HTML file embeds images and styles into one document, making it portable but larger and harder to edit.
- You will need to adjust file paths and links if you plan to move copied files between folders or devices.
- Always check a site's robots.txt file and terms of service before copying large amounts of content.
Saving a single page from your browser
The fastest method for one or two pages is your browser's built-in save function. In Chrome, Firefox, Safari, and Edge, press Ctrl+S (Windows) or Command+S (Mac), choose where to save, and select Webpage, Complete or Web Page with Images. The browser downloads the HTML file and creates a folder with the same name containing images, stylesheets, and scripts.
This method works well for articles, documentation, and reference pages. The folder structure keeps files organized and links between them usually stay intact. However, it only saves what is visible in the browser at that moment — if the page loads more content when you scroll, you will miss it. Dynamic content loaded by JavaScript often does not save correctly either.
If you want everything in a single file instead of a folder, use Save as Complete HTML in Firefox or install a browser extension like SingleFile for Chrome. These embed images and styles directly into the HTML, creating one large file that works anywhere without a companion folder.
Copying an entire website with Wget
Wget is a command-line tool built into macOS and Linux, and available for Windows through Git Bash or direct download. It recursively downloads a website by following links, respecting the site's crawl rules, and preserving the folder structure. Open your terminal or command prompt and run:
wget -r -l 5 -w 2 --wait-retry=1 https://example.com
The flags mean: -r (recursive), -l 5 (follow links up to 5 levels deep), -w 2 (wait 2 seconds between requests to avoid overloading the server), and --wait-retry=1 (retry once if a download fails). Adjust the depth number based on the site's size — a small site might need only 3 levels, a large one might need 7 or more.
Wget creates a folder named after the domain and stores everything inside. Links are rewritten to point to local files, so the site works offline. The trade-off is that Wget does not run JavaScript, so pages that load content dynamically will be incomplete. It also respects the site's robots.txt file by default, which may block certain folders.
Using HTTrack for visual site copying
HTTrack is a graphical tool available for Windows, macOS, and Linux that does what Wget does but with a point-and-click interface. Download it from httrack.com, open it, paste the website URL, and click Start. HTTrack shows a progress window as it downloads, lets you pause and resume, and stores everything in a folder you choose.
HTTrack offers more control than Wget through its options panel. You can set depth limits, exclude file types, limit bandwidth, and filter which folders to download. It also includes a built-in browser to preview the copied site before you finish. Like Wget, it does not execute JavaScript, so single-page applications and sites heavy on dynamic content will not copy completely.
After HTTrack finishes, open the index.html file in your browser to view the site. All internal links work because HTTrack rewrites them to point to local files. External links still point to the live internet, so you can click them if you are online.
Handling links and file paths after copying
When you copy a website, links between pages usually work because the download tool preserves the folder structure. However, if you move files to a different location or rename folders, links break. Absolute paths like /images/photo.jpg work fine, but relative paths like ../images/photo.jpg depend on the folder layout staying the same.
If you need to reorganize files after copying, use a text editor to find and replace broken paths. Search for the old path pattern and replace it with the new one across all HTML files. Alternatively, keep the original folder structure intact — it is simpler than editing hundreds of links.
If you copied a site that uses a subdirectory (like example.com/blog/), the download tool creates that folder structure locally. To view it in your browser, open the index.html file from the deepest folder, or adjust your file paths to match where you placed the files.
Copying sites that use JavaScript and dynamic content
Traditional download tools like Wget and HTTrack do not run JavaScript, so they miss content that loads after the page renders. If a site loads articles, images, or navigation through JavaScript, you will get an incomplete copy. For these sites, you need a different approach.
Puppeteer and Playwright are automation tools that open a real browser, wait for JavaScript to finish loading, and then save the rendered HTML. They require Node.js and some coding knowledge, but they capture what a human sees. Alternatively, use a browser extension like Nimbus Screenshot or DownThemAll to manually save pages one at a time after they fully load.
For single-page applications (SPAs) built with React, Vue, or Angular, copying the source files from GitHub is often easier than trying to download the rendered output. If the source is not public, you may not be able to copy the site at all without the developer's permission.
Checking robots.txt and respecting site policies
Before copying a large website, check its robots.txt file by visiting example.com/robots.txt. This file tells crawlers which folders they can and cannot access. If a folder is blocked, download tools will skip it by default. You can override this with flags like --ignore-robots-txt in Wget, but doing so may violate the site's terms of service.
Read the site's terms of service to understand what copying is permitted. Most sites allow personal, non-commercial copying for study or archival. Republishing, selling, or using copied content as your own is not permitted. If you plan to use the copied site as a template for your own project, rewrite the content and design significantly so it is not a duplicate.
Large-scale copying can strain a server, especially if you set aggressive download speeds. Use delays between requests (Wget's -w flag does this) and avoid copying during peak traffic hours. If the site owner contacts you about excessive downloading, stop immediately.
Frequently Asked Questions
Can I copy a website that is behind a login?
Download tools cannot log in automatically, so they will only save the public pages. To copy password-protected content, you would need to manually save each page after logging in through your browser, or use automation tools like Puppeteer that can handle login sequences. Check the site's terms of service first — copying private content may violate them.
What is the difference between copying a website and cloning a GitHub repository?
Copying a website downloads the files a browser sees — HTML, CSS, images, and JavaScript bundles. Cloning a repository downloads the source code a developer wrote, including version history and uncommitted changes. Repositories are meant to be cloned; websites are not always meant to be copied. Always check permissions first.
Why do some links break after I copy a website?
Links break when the download tool cannot rewrite them correctly, or when you move files after copying. Absolute paths like /images/photo.jpg usually survive, but relative paths like ../images/photo.jpg depend on folder structure. Keep the original folder layout, or use a text editor to find and replace broken paths across all files.
How do I view a copied website offline?
Open the index.html file in your browser by dragging it into a browser window, or right-clicking and selecting "Open with". If the site has subfolders, navigate to the correct index.html file. External links will not work offline, but all internal links should function if the download tool preserved the folder structure correctly.
Is it legal to copy a website?
Copying for personal study, archival, or learning is generally permitted under fair use. Republishing, selling, or using copied content as your own is not. Always check the site's terms of service and robots.txt file. If the site owner objects, stop copying and delete what you have downloaded.