What is HTTP Error 400 and how do you fix it?

A laptop showing an HTTP Error 400 Bad Request code on its screen
(Image credit: Shutterstock)

HTTP Error 400 – also known as the Bad Request 400 error – appears when the website server that hosts the page you are trying to view is unable to successfully handle the request for information, resulting in a broken page.

HTTP Error 400 can occur for a number of different reasons, but they all prevent a user from accessing a site's resources.

Unlike the HTTP Error 503, or the 502 Bad Gateway error, a Bad Request error usually appears as a result of something the user has done, such as typing in an incorrect URL. This means fixing it is typically far easier. The server itself can be the cause of an HTTP Error 400, but these cases are typically rare.

Depending on the browser you are using, an HTTP Error 400 can result in a blank page, or a page showing a more generic, user-friendly message, as is the case with Opera and Chrome.

However, there are a bunch of other messages you might encounter that all signal an HTTP Error 400, including:

  • Bad Request - Invalid URL
  • Bad Request: Error 400
  • HTTP Error 400 - Bad Request
  • HTTP Error 400. The request hostname is invalid
  • Bad Request. Your browser sent a request that this server could not understand

Website owners are able to customise the page that an HTTP Error 400 will display to visitors. An example of this is when web servers run Microsoft Internet Information Services (IIS), which results in a page breaking down the error in more detail, such as “400.3: Invalid If Header”, “400.2: Invalid Depth Header”, “400.1: Invalid Destination Header”, and more.

What causes an HTTP Error 400?

There’s a mixture of problems that can lead to a 400 Bad Request error. Here, we’ll go over five typical causes.

1. Bad URL Syntax

The most common reason an HTTP Error 400 appears is that the user has simply input an invalid URL string into their search bar. It may be that the website they ended up searching for does not exist, or the URL contains characters that do not conform with standard syntax, such as a backslash.

You can trigger an HTTP Error 400 manually, usually by typing "/%" after the URL.

For example, the following URL will send you to a valid page, the page to sign up to our daily newsletter:

'https://www.itpro.com/newsletter-signup'

However, if you were to type this URL in manually and type "/%" at the end of the URL, the request will result in an HTTP Error 400 page - as the server has received a 'Bad Request'.

2. Invalid Cookies

Occasionally, you may run into an HTTP Error 400 due to invalid Cookies. Typically these store information on the websites you visit, including authentication data to speed up the log in process. However, if that authentication data is no longer valid, it can trigger an HTTP Error 400 when you try to visit the site.

3. Incorrect file size

Another fairly rare, but otherwise perfectly feasible cause of an HTTP Error 400 is when a file is too large for the server to handle. Hosting providers usually specify the maximum upload size as a server configuration, limiting how large any one file can be. 

For example, the default size for many WordPress websites typically ranges from 4MB to 128MB. If you try to upload a file that is too big, the server may fail to fulfil the request, triggering the HTTP Error 400.

4. Unsynchronized DNS Cache

Browsers read domain names as IP addresses, which are stored locally in the Domain Name System (DNS) cache to improve the browsing experience. A HTTP Error 400 Bad Request can occur when the DNS data stored locally is out of sync with a website’s registered DNS information during a future interaction.

5. Server error

Although unlikely, servers can be responsible for an HTTP Error 400. A simple way to check for issues would be to load a website from a different browser and device – if the website fails to open in both Edge and Chrome, it's likely the issue is server-relate

How to fix a 400 Bad Request

It’s hard not to be unfazed by an HTTP error that tells you little about the problem. That said, fixing a 400 Bad Request error takes just a few steps. We’ve put together a few useful tips below to help you find your way out.

1. Recheck the URL

Since a malformed URL is the most common cause of the 400 Bad Request error, make sure there are no typing or syntax errors in your URL. Alternatively, for long URLs, consider using an online URL encoder, which automatically detects non-ASCII characters or invalid characters in a URL, saving you time and effort.

2. Check your internet connection

If you keep seeing a 400 Bad Request on nearly every website you visit, double check that your internet connection is stable and working correctly. There are many online tools available to check things like speed and latency.

If you do spot something unusual, it's worth consulting your internet service provider to rule out a failing connection.

3. Clear browser cookies

A website may fail to comply with your request due to old or corrupt cookies. 

As a quick fix, consider clearing your browser cache and cookies. Repeating this exercise from time to time will help you avoid running into a HTTP Error 400, and a host of other browser errors.

4. Clear DNS Cache

This works similar to clearing browser cookies and cache, except that it’s locally stored in your computer and may contain outdated information that doesn’t sync with the current webpage. You can clear old DNS information and records from your system within the Command Prompt in Windows and Mac.

5. Compress the file

If you run into an HTTP Error 400 right after uploading a file, try uploading a smaller file. If that works, you may conclude that the initial file exceeded the server limit. The best workaround for uploading a large file is to compress it. Most websites permit zip files that fall under the maximum upload size.

6. Deactivate browser extensions

While this isn’t a common solution for a 400 Bad Request error, some browser extensions may interfere with cookies. Temporarily disabling them might resolve the problem.

7. Restart your system

If you’ve tried all the above fixes and the HTTP Error 400 still continues, you might want to try turning off the system and turning it back on again. Although often derided, rebooting a device is astonishingly good at solving a wide range of problems. 


With the HTTP Error 400, you will want to not only restart your computer but any attached peripherals – including the router.

RELATED RESOURCE

An image of a desktop monitor on a red background, with check, cog, and padlock icons in blue circles, and a gold shield

(Image credit: Datto)

Discover a robust RMM solution that isolates devices and stops suspected ransomware from spreading

DOWNLOAD NOW

However, if restarting your system does not solve the issue, there is likely a problem with the website server. The cause can be anything from an overheated server room to a data centre power cut. Unfortunately, this means there's nothing further you can do, although there are likely teams of people working to solve the problem. Reporting the problem to the website's administrators could bring you some solace, but they may also provide you with an estimate as to how widespread the issue is, or how it will take to resolve.

Websites such as Down Detector provide a way for the wider community to report problems, and so it's a good idea to share the issue with others.

At the end of the day, HTTP Error 400 is very much like other HTTP errors in the way that its causes are frequently perplexing as well as baffling. In many cases, they can be traced back to a uncomplicated issue, such as expired browser files and cookies, wrongly inserted URLs, or even an incorrect file size.