Will I need a visa or can I use the visa free transit?
Yes as an US citizen, you are entitled for a free transit in China
for up to 24 hours since you have a confirmed onward ticket to
Melbourne (Australia) and without entering the country (i.e. clearing
According to Visa And Passport
National USA (US) /Embarkation Canada (CA) Transit China
(People's Rep.) (CN) Destination Australia (AU) ALSO CHECK
DESTINATION INFORMATION BELOW
China (People's Rep.) (CN)
TWOV (Transit Without Visa): Visa required, except for Holders of
confirmed onward air, cruise or train tickets for a max. transit For
details, click here time of 24 hours. Transit incl. multiple stops
(People's Rep.), with a total transit time of max. 24 hours,is
permitted. They must travel to a third country.
Also if you wish to go outside airport for sightseeing, you may apply for a temporary stay permit upon arrival
Source: 24 hour Direct Transit china
Under the 24-hour visa-free transit rule, no visa is required for
international flight, ship, or train passengers who transit directly
through mainland China and will stay for less than 24 hours. This
policy is applicable to almost all nationalities. Passengers should
hold tickets to a third country or region and have a confirmed seat.
In case that they want to leave the port for city sightseeing or transfer to another port during the 24 hours, they can apply for a
Temporary Stay Permit upon arrival. Those who transfer in more than
one city of China within 24 hours can also enjoy this policy. For
instance, if one’s trip is Los Angeles – Beijing – Shanghai – Bangkok
and the total time in China is less than 24 hours, the passenger can
still enjoy the 24-hour direct transit.
Also wikipedia confirms the same that you can get 24 Hour transit visa at Beijing airport:
The 24-hour transit rule allows multiple stops within Mainland China,
as long as the traveler has a flight segment leaving Mainland China in
24 hours, so it's possible to enter through a port of entry in China,
take multiple segments of domestic flights within China, and depart
from a different port of entry in under 24 hours. Contrary to the
transit rules of other countries, all travelers in transit are
required to go through immigration and customs even if they do not
intend to leave the airport, except for passengers arriving and
departing from Beijing Capital International Airport where they can
proceed directly to the sterile transit area without immigration
Leaving the transit area is allowed even for passengers who only have
one transit point within Mainland China, however they must also depart
China within 24 hours.