The most common work in chemistry is a gas pushing back its surroundings, as when a reaction makes gas in an open flask. The First Law and Sign Conventions needs its sign, and the The Ideal Gas Law gives its size.
🔑 Key idea
A gas that changes volume against a constant outside pressure does work $$w = -P_\text{ext}\,\Delta V.$$ Expansion ($\Delta V > 0$) gives $w < 0$: the system spends energy pushing back the surroundings. Compression gives $w > 0$. With $P$ in atm and $V$ in L, $w$ comes out in L·atm; convert with $1\ \text{L·atm} = 101.3\ \text{J}$. Expanding into a vacuum ($P_\text{ext} = 0$) does no work.
💡 Why it works
Work is force times distance. The outside pressure pushes on a piston of area $A$ with force $P_\text{ext}A$; if the piston moves out a distance $d$, the gas does work $P_\text{ext}Ad = P_\text{ext}\Delta V$ on the surroundings. Work done on the gas is the negative of that, hence the minus sign. For a reaction at constant temperature and pressure that changes the moles of gas by $\Delta n_\text{gas}$, the ideal gas law gives $P\Delta V = \Delta n_\text{gas}RT$, so $w = -\Delta n_\text{gas}RT$.
A gas expanding at constant pressure. The shaded rectangle on the P–V graph, $P\Delta V$, is the work done by the gas; for the gas, $w$ is minus that.
Try it in the Science Lab's First Law chapter. Remember that it writes $\Delta U = Q - W$ with $W$ done by the gas, so its $W$ is our $-w$.
✏️ Worked example: An expanding gas
A gas expands from $2.00\ \text{L}$ to $6.00\ \text{L}$ against a constant $1.50\ \text{atm}$. Find $w$ in joules.
$\Delta V = 6.00 - 2.00 = +4.00\ \text{L}$.
$w = -P\Delta V = -(1.50)(4.00) = -6.00\ \text{L·atm}$.
$-6.00 \times 101.3 = -608\ \text{J}$.
Answer: $-608\ \text{J}$
✏️ Worked example: Heat and work together
A gas absorbs $500\ \text{J}$ of heat while expanding from $2.0\ \text{L}$ to $5.0\ \text{L}$ against $1.00\ \text{atm}$. Find $\Delta U$.
At $25^\circ\text{C}$ and constant pressure, $\mathrm{CaCO_3(s)} \to \mathrm{CaO(s)} + \mathrm{CO_2(g)}$ makes 1 mol of gas per mole of reaction. Find $w$.
Dropping the minus sign, so an expanding gas seems to gain energy from its own expansion, or forgetting to convert L·atm to joules before adding to a heat in joules. Check: expansion always makes $w$ negative; and an answer in L·atm must be multiplied by 101.3 before it meets $q$.