This article is from the Dog Crating FAQ, by Cindy Tittle Moore with numerous contributions by others.
Remember, your ultimate goal in using the crate is to produce an
easily housetrained dog and one that can be trusted in the house.
Therefore, you should consider the use of a crate for a dog to be
_temporary_. You are always working toward the time when you do not
need to use a crate extensively.
With housetraining, it is only a matter of time for the pup to outgrow
the need for a crate. As as puppy gets older, it will naturally
develop ways of telling you that it needs to go (but probably not
before about 4-6 months, be patient), especially if you encourage
this. As this starts to develop, you can decrease the crate usage.
Always keep a close eye on your pup -- the trouble you take now will
pay big dividends later. If you need to, put a leash on your pup and
attach it to your waist. That keeps the pup from wandering off into
trouble. By the time your puppy is about 6-8 months, he should be able
to sleep through the night either in an open crate or a dog bed.
Many breeds, especially the larger and more active ones, will need to
be crated during their adolescence until they can be trusted in the
home, if you cannot leave them outside in the yard while you are gone.
There are several things you need to keep in mind. The first is that
this type of crating is never to be a permanent arrangement except for
those rare cases where the dog proves completely unreliable. While
this does happen, it's more common for the dog to be sufficiently
mature by the time they are two or so to be left alone in the house.
To make the transition between keeping your dog in the crate and
leaving him out when you are at work, start preparing your dog on
weekends. Leave him in your house for an hour and then come back.
Maybe it needs to be fifteen minutes. Whatever. Find the time that
works, and make a habit of leaving him unsupervised in the house for
that long. Be sure to praise him when you come back. (Leave the crate
open -- available but open -- while you are gone.) When you know the
dog is reliable for this period of time, gradually add 15-30 minute
increments to the dog's "safe time." Don't be surprised if this takes
months or even a year.
Now, there are some dogs that are never reliable when left inside.
This might include dogs that were rescued, dogs that have separation
anxiety, dogs that destroy things indiscriminately, or who mark or
otherwise eliminate in the house.