I've gotten a ton of questions regarding how bank deposits get processed. I'm no banking expert, but I know a bit about it. I will tell you everything I know, and if readers have more info, they can add it in the comments. Hopefully, we'll all learn something.
First, banks do not process each individual transaction (deposit or withdrawal) as it happens. As transactions come to the bank during the day, they are collected and held until the evening. At some time during the night, usually over the course of several hours, all the transactions are processed in batches. Batches are groups of transactions that are big enough to be efficient, but small enough not to overwhelm the computer system. I will use my cookie making example again: If you need 500 cookies, you wouldn't try to make enough dough for 500 cookies in an enormous bowl and then put all 500 cookies in the oven at the same time. You probably also wouldn't make enough dough for just one cookie, and cook one cookie at a time. Instead, you would do the cookies in batches, maybe 50 cookies at a time, over the course of a day. This is the same concept as banks processing transactions.
Banks do their processing overnight because it is when their computer resources are not being actively used by their employees. The hours that each bank processes are a little different, but basically it is in the middle of the night. This is why you might find that your transactions process at midnight one time, then not to 6 am on a different day.
Then we come to the issue of ordering the transactions. I have read a number of well-documented articles that claim that many banks will process your transactions in a particular order, particularly if you are going to overdraft your account and incur overdraft fees. I've never had this experience, but it has been years since we messed up our account, and we also have overdraft protection. It seems entirely likely to me as banks are in the business of making money. In my experience, however, Navy Federal Credit Union does process payments before it processes withdrawals. Apparently, that is unusual and it is yet another reason why I like Navy Federal.
Every payday, I read lots of comments from people comparing notes, wondering why their deposit was posted at a different time than their friend's deposit. I hope this helps you to understand how this could happen.
Please, my banking readers, share your information.