ASME B31.4 / B31.8
Pipeline transportation systems for liquids and slurries, and gas transmission and distribution piping
ASME B31.4 liquid and B31.8 gas pipeline codes explained: pump and compressor stations, location classes, design factors, testing and the B31.3 break.
Scope
ASME B31.4 covers pipelines that carry liquids such as crude oil, condensate, natural gas liquids, liquefied petroleum gas and carbon dioxide. ASME B31.8 covers gas transmission and distribution piping. Both cover design, materials, construction, testing, operation and maintenance, and both have chapters for offshore pipelines.
On oil and gas facilities they apply to export and import pipelines, infield flowlines in some jurisdictions, risers, pig launchers and receivers, block valve stations and slug catchers. The break between the pipeline code and ASME B31.3 plant piping is normally set at the pipeline isolation valve or pig trap, and must be shown on the drawings.
Many offshore pipelines are designed to DNV-ST-F101 or ISO 13623 instead. National regulations, such as US federal pipeline rules, often reference B31.4 and B31.8 and add their own requirements.
Two pipeline codes in the B31 family
B31.4 and B31.8 are the two pipeline sections of the ASME B31 Code for Pressure Piping. B31.4 is titled Pipeline Transportation Systems for Liquids and Slurries. B31.8 is titled Gas Transmission and Distribution Piping Systems. Both cover a pipeline for its whole life: design, materials, construction, testing, operation, maintenance and corrosion control.
B31.4 took in the former slurry code, B31.11, in its 2012 edition, and it has its own chapter for carbon dioxide pipelines. B31.8 is supported by B31.8S, a separate standard for managing the integrity of gas pipelines.
In the United States, the federal pipeline safety rules for hazardous liquids (49 CFR Part 195) and for gas (49 CFR Part 192) are the legal requirement. They refer to parts of these codes and add requirements of their own, and operators often specify the codes as well.
| Topic | B31.4: liquids and slurries | B31.8: gas |
|---|---|---|
| What it carries | Crude oil, condensate, liquid products, NGL, LPG, liquid CO2, ammonia and slurries | Natural gas, from gathering lines through transmission to distribution |
| Stations | Pump stations, tank farms and terminals | Compressor stations, regulator and metering stations |
| Design basis | Hoop stress limited to a fraction of SMYS, commonly 0.72 | Hoop stress limited by a design factor that falls from 0.80 to 0.40 as population density rises |
| Pressure test | Commonly 1.25 times the internal design pressure, held at least 4 hours | Depends on the location class and the test medium |
| Offshore | Chapter IX, offshore liquid pipelines | Chapter VIII, offshore gas transmission |
| Special services | Chapter X carbon dioxide, Chapter XI slurry and process water | Chapter IX sour gas |
Commonly quoted values and chapter numbers from published editions. Numbering and values can change between editions, so confirm them against the edition your project names.
A crude oil pump station under B31.4
B31.4 covers the piping of pump stations, tank farms and terminals on a liquid pipeline, as well as the line between them. It does not cover the pump itself. The code leaves out pumps, pressure vessels, heat exchangers, meters and similar equipment, and auxiliary piping such as water, air, steam, lubricating oil and fuel.
So on a crude oil pipeline the station piping follows B31.4, the mainline centrifugal pumps are normally bought to API 610, and the tanks follow API 650. The station design brings these together. B31.4 then asks the following of the station. These points follow published editions, so confirm them against the edition your project names.
- 1
Station piping to the pipeline rules
Manifolds, unit piping and scraper traps that can see mainline pressure are built to the code’s welding, testing and corrosion control rules, like the line itself.
- 2
Pressure protection
Pressure controls, pressure limiting devices and relief valves keep the pipeline within its design pressure. Surge from a pump trip or a fast valve closure may not raise any point more than 10 % above its internal design pressure, so a surge study is part of the design.
- 3
Pumps and drivers
Pumps and their prime movers are installed to detailed plans and specifications, with the maker’s instructions for setting, alignment and auxiliary piping as the minimum.
- 4
Controls tested before service
Controls and protective devices are tested after installation, under conditions close to real operation.
- 5
Layout and access
The station sits on land the operator owns or leases, fenced, with clear space for maintenance and fire fighting and good road access.
- 6
Fire protection
Fire pumps, where fitted, need a power source separate from the station supply, so an emergency shutdown does not stop them.
- 7
Operation and maintenance
Chapter VII has a section on operating and maintaining pump stations, terminals and storage. National rules, such as 49 CFR Part 195 in the US, add their own station requirements.

Location classes in B31.8
A gas pipeline that fails releases a large volume of gas quickly, so B31.8 asks for a stronger pipe where more people live. It does this with location classes.
To find the class, draw a corridor a quarter of a mile wide with the pipeline on its centreline. Split the route into one-mile sections placed to catch the most buildings, and count the buildings intended for human occupancy in each. Each dwelling in a block of flats counts as one building.
The class sets the design factor: the fraction of the pipe’s specified minimum yield strength (SMYS) that the hoop stress may reach. It also affects test pressures, valve spacing and other rules. A school, hospital or other place where people gather can raise a Class 1 or 2 section to Class 3 rules.
| Location class | Buildings in a one-mile section | Basic design factor |
|---|---|---|
| Class 1, Division 1 | 10 or fewer | 0.80 |
| Class 1, Division 2 | 10 or fewer | 0.72 |
| Class 2 | 11 to 45 | 0.60 |
| Class 3 | 46 or more | 0.50 |
| Class 4 | Multistorey buildings common, heavy traffic | 0.40 |
Commonly quoted reference values. Division 1 applies only where the pipe has been qualified and tested for the higher stress. Some facilities, such as compressor station piping and some crossings, take a lower factor. Confirm against the current edition.
Compressor stations under B31.8
A compressor station is the gas counterpart of a liquid pump station. B31.8 covers its piping and gives it a lower design factor, commonly quoted as 0.50 in Classes 1 to 3 and 0.40 in Class 4, whatever the factor of the line outside the fence.
Apart from small unattended stations, a transmission compressor station needs an emergency shutdown system. It blocks gas out of the station, blows down the station piping to a safe place, and stops the compressors and gas-fired equipment. It can be started from at least two points outside the gas area. The compressors themselves are equipment, normally bought to API 617 for centrifugal machines or API 618 for reciprocating ones.
Wall thickness from the design factor
Both codes size the pipe wall with the hoop stress formula, often called Barlow’s formula: pressure = 2 × S × t / D. Here S is the allowed hoop stress, t is the wall thickness and D is the outside diameter. The allowed stress is the SMYS times the design factor, with further factors for the weld seam and, in B31.8, for temperature.
Take 12-inch line pipe, 323.9 mm outside diameter, with a 9.5 mm wall in grade X52 (L360), whose SMYS is 360 MPa. At 100 % of SMYS the pipe would reach 2 × 360 × 9.5 / 323.9 = 21.1 MPa. With a design factor of 0.72 and seam and temperature factors of 1, the design pressure is about 15.2 MPa, or 152 bar. In a B31.8 Class 3 area the factor is 0.50, and the same pipe is good for about 106 bar.
These figures are before any corrosion allowance, and the real design also checks external loads, fatigue and stability. Pipe and wall data for the library are on ASME B36.10M and in the dimension tables.
Key concepts
- Hoop stress design
- Wall thickness is set by limiting the hoop stress from internal pressure to a fraction of the specified minimum yield strength (SMYS) of the pipe. The Barlow formula relates pressure, diameter, wall and stress.
- Design factors
- B31.4 uses a single design factor for most liquid pipelines, commonly 0.72 of SMYS. B31.8 uses design factors that fall as population density rises. Check the current edition for the factors and any exceptions.
- Location classes
- B31.8 assigns Location Class 1 to 4 by the number of buildings for human occupancy near the line. Higher classes need thicker walls or lower operating stress, and closer valve spacing.
- Offshore and risers
- Both codes include offshore chapters covering on-bottom stability, installation loads and risers. Platform risers are often designed to the pipeline code up to the topside isolation valve.
- Testing and integrity
- Pipelines are hydrotested before service and then managed by integrity programmes: cathodic protection, inline inspection with pigs, and pressure and corrosion monitoring.
Questions
What does ASME B31.4 require for pumps in crude oil pipelines?
B31.4 covers the piping of a pump station: suction and discharge piping, manifolds, valves, and the relief and pressure control that protect the pipeline. It requires that the station cannot raise the pipeline above its allowed pressure, with a limited margin for surge. It does not set the design of the pump itself. Mainline centrifugal pumps are normally bought to API 610.
What is the difference between ASME B31.4 and B31.8?
B31.4 is for liquids, such as crude oil, products and liquid carbon dioxide. B31.8 is for gas. B31.4 uses one design factor for most pipelines. B31.8 lowers the design factor as the number of buildings near the line rises, through its location classes, because a gas release affects a wider area.
Where does ASME B31.3 stop and the pipeline code start?
The break is set by the project and marked on the drawings. It is normally at the pig trap or at the first isolation valve where the pipeline enters the plant or platform. Plant piping on one side follows ASME B31.3, and the pig launcher and riser on the other side follow the pipeline code.
What is ASME B31.8?
ASME B31.8 is the code for gas transmission and distribution piping systems. It covers gas pipelines and their compressor, regulator and metering stations, from design and materials to testing, operation and corrosion control, with chapters for offshore pipelines and sour gas. Its main idea is the location class: the more people near the line, the lower the allowed pipe stress.
What are the location classes in ASME B31.8?
They grade a gas pipeline route by the number of buildings for human occupancy in a quarter-mile corridor along each mile. Class 1 has 10 or fewer, Class 2 has 11 to 45, Class 3 has 46 or more, and Class 4 is where multistorey buildings are common. The commonly quoted design factors fall from 0.72, or 0.80 in Class 1 Division 1, down to 0.40 in Class 4.
What is the hydrotest pressure for an ASME B31.4 pipeline?
The commonly quoted requirement is a hydrostatic test to at least 1.25 times the internal design pressure, held for at least 4 hours. Carbon dioxide lines must be tested with water. National rules, such as 49 CFR Part 195 in the US, set their own test requirements, so check both against the current editions.
In Deck Twin
There is no pipeline design calculation in Deck Twin. The riser, pig launcher, insulating joint, slug catcher and pipeline valve station cite these codes and model the typical arrangements: riser ESDV and insulating joint, launcher barrel and closure, block valve with bypass and blowdown. Their flanges and pipe come from ASME B16.5 and B36.10M values.
Deck Twin uses these standards as reference values for visualisation. Check the current edition of each standard before using any value for design, procurement or fabrication.