Have you encountered 400 bad request errors when accessing a URL and don’t know how to fix it?
You’ve just landed on the right page.
The 400 bad request errors can appear in different formats depending on the website, device, and even browsers.
HTTP error 400- Bad request, Bad Request: Error 400, and 400 Bad Request – Request Header Or Cookie Too Large are all variations of the same error.
This tutorial will teach you how to fix HTTP 400 bad request errors.
Frequently Asked Questions
What is a 400 Error?
The 400 Bad request error is an HTTP status code that indicates that the server cannot process the request sent by the client.
The 400 Bad request error is a client-side error that has nothing to do with the server but the user’s device, browser, or internet connection.
What Causes a 400 Error?
The number one cause of 400 bad request errors is an invalid or incorrect URL.
Corrupt browser cached files, deceptive query routing, and malformed request syntax can cause the problem.
Also, most servers have a file size limit.
Any attempt to upload a larger file will return 400 bad request errors.
How to Fix HTTP 400 Bad Request Error
Since the HTTP 400 Bad request status code represents a client-side error, there are some potential fixes you should first attempt.
Before attempting any fixes below, restart your PC and ensure your internet connection is stable.
Restarting your PC will clear your device RAM and stop background processes that might interfere with your browser request, especially processes that need internet access.
Once you get those out of the way, you can start troubleshooting with the following methods;
- Double-check the URL
- Clear Browsing Cookies and Cache
- Flush DNS Cache
- Turn off Browser Extension
- Reduce File Size
Double-check the URL
A mistyped URL, incorrect URL syntax, or unwanted characters in the URL string often cause a 400 bad request error.
The first solution is to check that the URL you type is correct.
For example, https://bloggingtips.com/about-us/ is the correct URL that will bring you to our about page.
On the other hand, typing https://bloggingtips.com/%about-us/ will return a 400 error.
You must pay attention to symbols like % and -for long URLs with special characters.
It’s easy to make any of these mistakes when entering URLs manually.
Always make sure you copy and paste URLs.
Once you are certain that the URL is error-free.
Access it again and see if your browser doesn’t throw up a 400 bad request error.
If it does, it means your browser cache and cookies need some housekeeping.
Clear Browsing Cookies and Cache
Caches are necessary evils.
They are stored to improve the user’s experience and the page loading speed of the website you visit.
On the other hand, cookies store login credentials and other information about the user.
While they are extremely useful, when these files grow big and left to pile over time, they get corrupted or outdated.
Thus, the web server might fail to recognize your browser on the next request and return 400 bad request errors.
In this case, deleting the browser cache and cookies will fix the 400 bad request error.
Follow these steps to clear browsing cookies and cache.
Click the menu (three vertical dots) icon at the top left corner of your browser—select Settings from the options.
Go to Privacy and security on the left pane and select Clear browsing data.
Next, check the cookies and cache boxes and click the Clear data button.
Now, try the URL again to see if it works.
Proceed to the next solution if 400 bad request errors still appear.
Flush DNS Cache
A corrupted and outdated DNS cache can result in an HTTP 400 bad request error like a browser cache.
The difference between these two cache files is that the browser stores the former while the operating system stores the latter.
If the 400 bad request errors persist after clearing your browser cache, then the DNS cache might cause the problem.
To clear the DNS cache on a Windows device, follow these steps;
Press the Windows start button, enter Command Prompt in the search box, and select the Best match result.
Type in this command: ipconfig /flushdns, and hit Enter on your keyboard.
Once complete, you’ll see this message: Windows IP Configuration.
Successfully flushed the DNS Resolver Cache.
For macOS users, here’s how.
Press Command + Space on your Keyboard, then type Terminal.
Double-click the application icon to open Terminal.
Next, paste this command: sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder
Enter your Mac’s password and Press Enter to complete the process.
Turn off Browser Extension
Browser extensions are known for interfering with website cookies and might be the culprit here.
When your browser sends out a request, and a browser extension interferes, the server will interpret it as an invalid request, then return 400 errors.
The only way to know if an extension is a cause is to disable all your browser extensions and reactivate them one by one.
If the error disappears after deactivating all your extensions, one of them is the culprit.
To find out which, start turning on the plugin one by one and refresh the webpage each time.
Once you find the culprit, you can keep it turned off and remove it altogether by using these steps;
Click the menu (three vertical dots) icon at the top left corner of your browser.
Go to More Tools, then select Extensions from the next menu.
Toggle off the button next to the Extensions to disable them.
Reduce File Size
Every web server has a maximum upload file size limit.
For WordPress websites, the default is 128 MB.
If you try to upload any file that exceeds this limit, you’ll get the 400 bad request error.
You can verify if this is the problem by uploading a smaller file.
If it’s successful, your file is too large, and you’ll need to reduce the size.
There are many free tools online that you can use to compress your large images, pdf, audio, and even video files.
You should be aware that compressing your file might reduce its quality.
Images and PDF files can become blurry, rendering videos less attractive.
So always check your file after compression to be sure the quality is still acceptable.
More Helpful Error Troubleshooting Tutorial:
- How to Fix 502 Bad Gateway Error: Another server-side error your WordPress website can run into is the 502 Bad Gateway Error. Here’s how to deal with it once and for all.
- How to Fix Secure Connection Failed Error:Are you seeing the secure connection failed error on your website? Learn how to fix it now.
- How to Fix 401 Error: Here’s everything you need to know about the HTTP 401 error and what you can do to fix it.
The troubleshooting tips above should help fix the HTTP 400 bad request error.
If you’ve tried all the solutions above, and the problem continues, it might be server misconfigurations.
In this case, you can reach out to notify the site admin.
Do you have other fixes for the 400 bad request error?
Feel free to share it with us in the comment section below.