3GPP TS 38.321 · TS 38.211 · TS 38.213

5G NR Random Access (RACH) Procedure

The definitive interactive guide to MSG1→MSG4. Step through a live 4-step simulation, decode a real RAR byte-by-byte, race 4-step vs 2-step access, and compute RA-RNTI, Timing Advance and PRACH power — exactly as the specs define them.

MSG1 → MSG4 2-STEP MSGA/MSGB RA-RNTI CALC TA ESTIMATOR ZADOFF-CHU
4-Step RACH Procedure
The contention-based Random Access procedure as defined in 3GPP TS 38.321, visualized step by step
1
UE → gNB (Uplink)

MSG1: PRACH Preamble

The UE selects a random preamble from the set of 64 available preambles and transmits it on the PRACH occasion. The preamble is a Zadoff-Chu sequence (root sequence length 839 for long format, 139 for short). The gNB detects the preamble via correlation and estimates the Timing Advance (TA).

Preamble Index: 0-63 PRACH Format: 0-3, A1-C2 Root Sequence: u Cyclic Shift: Cv PRACH Occasion: (t, f)
2
gNB → UE (Downlink)

MSG2: Random Access Response (RAR)

The gNB responds within the RA-Response window (ra-ResponseWindow) on the PDSCH, addressed via RA-RNTI on PDCCH. The RAR contains the Timing Advance Command (11-bit), UL Grant for MSG3 (27-bit), Temporary C-RNTI (16-bit), and backoff indicator if contention is detected.

RA-RNTI: 1-65535 TA Command: 0-3846 UL Grant: 27 bits TC-RNTI: 16 bits Backoff: 0-960ms
3
UE → gNB (Uplink)

MSG3: RRC Connection Request / Resume

Using the UL Grant from MSG2 and applying the TA, the UE transmits on PUSCH. Contains the UE's identity: CCCH SDU with RRC Setup Request (5-bit random value + establishment cause) for initial access, or RRC Resume Request (I-RNTI) for connection resumption. HARQ is applied.

CCCH SDU UE Identity Est. Cause HARQ Process PUSCH Resources
4
gNB → UE (Downlink)

MSG4: Contention Resolution

The gNB echoes back the UE Identity received in MSG3, transmitted on PDSCH and addressed by TC-RNTI on PDCCH. If the UE identity matches, contention resolution is successful — the TC-RNTI becomes the C-RNTI and the UE is connected. If not, the UE restarts the procedure with backoff.

C-RNTI Assignment Contention Resolution ID RRC Setup / Resume PDCCH + PDSCH
Live RACH Simulation
Step through each phase of the 4-step Random Access procedure with detailed technical breakdowns

5G NR Random Access Procedure

The Random Access Channel (RACH) procedure establishes initial uplink synchronization between the UE and gNodeB. This simulation walks you through every sub-step with detailed technical context from 3GPP TS 38.321.

4
Message Steps
28
Sub-steps Covered
~5 min
Full Walkthrough

Press "Start RACH" then use "Next Step" to walk through at your own pace

1

MSG1: PRACH Preamble Transmission

UE → gNodeB (Uplink)
1a
SSB Detection & PRACH Resource Selection

UE first detects the Synchronization Signal Block (SSB) and reads the System Information Block 1 (SIB1) which contains RACH-ConfigCommon. From this, the UE determines available PRACH occasions (time slots & frequency resources) mapped to the detected SSB beam index.

SIB1 → rach-ConfigCommon: prach-ConfigurationIndex: 27 (Format 0, SFN mod 2 = 0) msg1-FDM: 1 (single PRACH in freq domain) msg1-FrequencyStart: 0 (offset from BWP start) ssb-perRACH-OccasionAndCB-PreamblesPerSSB: oneEighth, n60
1b
Preamble Selection (Zadoff-Chu Sequence)

UE randomly selects a preamble index from the contention-based (CB) pool. For CBRA, preambles 0-63 are divided into Group A and Group B based on messageSizeGroupA and messagePowerOffsetGroupB. The preamble is a Zadoff-Chu sequence of length 839 (long format) or 139 (short format).

Preamble Generation: Root Sequence Index (u): 22 (from rootSequenceIndex in SIB1) Cyclic Shift (Cv): 13 (from zeroCorrelationZoneConfig = 1) Selected Preamble Index: #37 (random from Group A: 0-55) Sequence Length: 839 (Long, PRACH Format 0) x_u,v(n) = x_u((n + Cv) mod N_ZC)
1c
PRACH Power Control (Open Loop)

The UE calculates the initial PRACH transmit power using open-loop power control. It measures the downlink path loss from SSB RSRP and adds it to the target preamble received power configured by the network.

P_PRACH = min(P_CMAX, preambleReceivedTargetPower + PL) preambleReceivedTargetPower: -110 dBm (from SIB1) RSRP measured: -85 dBm Path Loss (PL) = SSB_TX_Power - RSRP = 24 - (-85) = 109 dB P_PRACH = min(23, -110 + 109) = min(23, -1) = -1 dBm PREAMBLE_POWER_RAMPING_COUNTER: 1 (first attempt)
1d
PRACH Occasion & Transmission

The UE transmits the selected preamble on the next available PRACH occasion. The PRACH signal occupies specific time-frequency resources defined by the PRACH format. For Format 0, the preamble duration is 0.8ms + 0.1ms CP (total ~1ms).

PRACH Transmission: Format: 0 (Long sequence, L_RA = 839, SCS = 1.25 kHz) Subframe: 1 | Slot: 0 | Symbol: 0 Frequency offset: msg1-FrequencyStart = 0 Guard period: 0.1 ms (Cyclic Prefix) Preamble duration: 0.8 ms ── UE transmits Preamble #37 on PRACH occasion ──
The gNB performs correlation-based detection and estimates Timing Advance from the preamble arrival time
1e
Start RA-Response Window Timer

After transmitting the preamble, the UE starts monitoring PDCCH for a response addressed to the calculated RA-RNTI. The monitoring window starts at the end of the PRACH preamble transmission, not the beginning.

RA-RNTI = 1 + s_id + 14 * t_id + 14 * 80 * f_id + 14 * 80 * 8 * ul_carrier_id s_id = 0 (first OFDM symbol of PRACH) t_id = 1 (slot index within frame) f_id = 0 (frequency index) ul_carrier_id = 0 (NUL carrier) → RA-RNTI = 1 + 0 + 14*1 + 0 + 0 = 15 ra-ResponseWindow: 10 slots (from SIB1) Timer starts: end of PRACH preamble TX
2

MSG2: Random Access Response (RAR)

gNodeB → UE (Downlink)
2a
gNB Preamble Detection & TA Estimation

The gNB's PRACH detector performs correlation with all 64 possible cyclic shifts of each root sequence. When a preamble is detected, the correlation peak timing offset gives the round-trip propagation delay, from which the Timing Advance command is calculated.

gNB PRACH Processing: Detected Preamble Index: #37 ✓ Correlation Peak Power: -98 dBm (above threshold: -115 dBm) Round-trip delay: 6.51 μs Estimated distance: 976 m Timing Advance = round_trip / (16 * 64 * T_c / 2^μ) TA Command: 42 (11-bit value, range 0-3846)
2b
RAR MAC PDU Construction

The gNB constructs a MAC PDU containing one or more RAR entries. Each RAR entry is 7 bytes and contains the matched preamble's response. Multiple preamble responses can be batched in a single RAR if multiple UEs accessed simultaneously.

RAR MAC PDU Structure (TS 38.321 §6.2.3): ┌─────────────────────────────────────────────────┐ │ MAC subheader: │ │ E=0 (last), T=1 (RAR), RAPID=37 (6 bits) │ ├─────────────────────────────────────────────────┤ │ MAC RAR (56 bits = 7 bytes): │ │ R (1 bit) : 0 │ │ TA Command (12b) : 42 → N_TA = 42*16*64/2 │ │ UL Grant (27 bits): PUSCH resources for MSG3 │ │ TC-RNTI (16 bits) : 0x4A3B (temp identifier) │ └─────────────────────────────────────────────────┘
2c
PDCCH + PDSCH Scheduling (RA-RNTI)

The gNB schedules the RAR on PDSCH and signals it via DCI Format 1_0 on PDCCH, scrambled with the RA-RNTI = 15. The UE, which has been monitoring PDCCH since the RA-Response window opened, detects this DCI and reads the PDSCH allocation.

DCI Format 1_0 (scrambled with RA-RNTI = 15): Frequency domain resource assignment: RBs 10-25 Time domain resource assignment: slot offset k0=0 MCS Index: 2 (QPSK, code rate 0.19) TB Size: 7 bytes (1 RAR entry) HARQ Process: N/A (no HARQ feedback for RAR) UE decodes PDCCH → finds DCI with RA-RNTI → decodes PDSCH
2d
UE Processes RAR — Checks RAPID Match

The UE reads the RAR MAC PDU and checks if any RAR entry contains its preamble index (RAPID = 37). If matched, the UE extracts TA Command, UL Grant, and TC-RNTI. If no match within ra-ResponseWindow, the UE retransmits the preamble with powerRampingStep increase.

UE RAR Processing: Received RAPID: 37 ←→ Transmitted Preamble: 37 ✓ MATCH! Extracted values: Timing Advance Command: 42 → N_TA = 21,504 T_c UL Grant: decoded → PUSCH allocation for MSG3 Temporary C-RNTI: 0x4A3B UE applies TA → adjusts UL timing by N_TA * T_c = 6.51 μs UE stores TC-RNTI for MSG3/MSG4 identification
2e
Backoff Indicator (Contention Handling)

If the MAC subPDU includes a Backoff Indicator (BI), it means the cell is experiencing high PRACH load. The UE must wait a random time within [0, BI_value] before retransmitting if needed. Common BI values: 5ms, 10ms, 20ms, 40ms, 60ms, 80ms, 120ms, 160ms, 240ms, 320ms, 480ms, 960ms.

In this simulation: No backoff needed — RAPID matched and UL grant received successfully
3

MSG3: Scheduled Transmission (RRC Request)

UE → gNodeB (Uplink)
3a
UL Grant Decoding & PUSCH Resource Mapping

The UE decodes the 27-bit UL grant from the RAR to determine PUSCH resources for MSG3. The grant specifies frequency hopping, MCS, time domain allocation, and TPC command. The UE prepares PUSCH transmission according to these parameters.

UL Grant Decoding (27 bits, TS 38.213 §8.2): Frequency hopping flag (1 bit): 0 (no hopping) PUSCH freq resource (14 bits): RBs 20-35 PUSCH time resource (4 bits): slot offset k2 = 4 MCS (4 bits): Index 0 (QPSK, R=0.12) TPC command (3 bits): 0 dB adjustment CSI request (1 bit): 0 (no CSI) Transport Block Size: 72 bits (9 bytes) — sufficient for CCCH SDU
3b
Timing Advance Application

Before transmitting, the UE applies the Timing Advance received in MSG2. This ensures the UE's uplink signal arrives at the gNB aligned with the slot boundary. The TA compensates for the propagation delay — critical for maintaining uplink orthogonality.

Timing Advance Application: TA Command from RAR: 42 N_TA = TA * 16 * 64 / 2^μ = 42 * 16 * 64 / 2 = 21,504 T_c Time offset = N_TA * T_c = 21,504 * (1/499.2MHz/4096) = 21,504 * 0.509 ns = 6.51 μs UE advances uplink timing by 6.51 μs → Signal arrives 6.51 μs earlier at gNB → Compensates for ~976m round-trip propagation
3c
CCCH SDU Construction (RRC Setup Request)

For initial access, the UE constructs an RRC Setup Request message containing the UE's identity and the establishment cause. This is placed in a CCCH (Common Control Channel) SDU. The identity is either a 5-bit random value (first time) or a truncated S-TMSI (if previously registered).

RRC Setup Request (TS 38.331 §5.3.3): ue-Identity: randomValue = 10110 (5-bit random) establishmentCause: mo-Signalling spare: 1 bit MAC PDU for MSG3: ┌──────────────────────────────────────┐ │ MAC subheader: LCID = 0 (CCCH) │ │ MAC SDU: RRCSetupRequest │ │ ue-Identity: randomValue(10110) │ │ establishmentCause: mo-Signalling │ └──────────────────────────────────────┘ Identified by TC-RNTI: 0x4A3B on PUSCH
3d
PUSCH Transmission & HARQ Process

The UE transmits MSG3 on the PUSCH resources with the applied TA. A HARQ process is assigned for MSG3, enabling retransmission if the gNB fails to decode. The gNB acknowledges via PHICH or DCI on PDCCH.

MSG3 PUSCH Transmission: HARQ Process ID: 0 New Data Indicator: 1 (new transmission) Redundancy Version: 0 Power: P_PUSCH calculated from TPC + open-loop ── UE transmits MSG3 on PUSCH with TC-RNTI ── gNB decodes MSG3 → extracts UE identity If decode fails → gNB sends NACK → UE retransmits (same HARQ)
3e
Contention Resolution Timer Starts

After transmitting MSG3, the UE starts the ra-ContentionResolutionTimer. If MSG4 is not received before this timer expires, the UE considers the RA attempt failed and may restart with a new preamble and power ramp.

ra-ContentionResolutionTimer: 64 subframes (64ms) Timer starts: after MSG3 transmission UE monitors PDCCH for: → DCI scrambled with TC-RNTI (0x4A3B) → Containing Contention Resolution identity If timer expires → RA failure → restart with new preamble If HARQ NACK → retransmit MSG3 (timer continues)
Multiple UEs may have selected the same preamble #37 — this is contention! Only one will succeed in MSG4
4

MSG4: Contention Resolution

gNodeB → UE (Downlink)
4a
gNB Processes MSG3 & Prepares Contention Resolution

The gNB successfully decodes MSG3, extracts the UE identity (CCCH SDU content), and prepares the contention resolution message. The gNB echoes back the exact UE identity received in MSG3 so the UE can verify it was the intended recipient.

gNB MSG3 Processing: Decoded TC-RNTI: 0x4A3B Extracted UE Identity: randomValue(10110), mo-Signalling Contention Resolution ID = first 48 bits of CCCH SDU → This is the unique identifier that resolves contention → Only the UE whose identity matches will accept MSG4
4b
RRC Setup Message Construction

Along with contention resolution, the gNB sends an RRC Setup message (or RRC Resume for reconnection). This contains the dedicated radio resource configuration: SRB1 setup, cell group config, and initial BWP parameters.

RRC Setup Message (TS 38.331 §5.3.3): radioBearerConfig: srb-ToAddModList: SRB1 (Signalling Radio Bearer 1) rlc-Config: am (Acknowledged Mode) logicalChannelConfig: DCCH masterCellGroup (CellGroupConfig): rlc-BearerToAddModList: [...] mac-CellGroupConfig: schedulingRequestConfig: [...] bsr-Config: periodicBSR-Timer, retxBSR-Timer physicalCellGroupConfig: p-NR-FR1: 23 dBm (P_CMAX) spCellConfig: serving cell configuration
4c
PDCCH + PDSCH Delivery (TC-RNTI)

The gNB schedules MSG4 on PDSCH, signaled via DCI on PDCCH scrambled with the TC-RNTI (0x4A3B). The UE, which has been monitoring PDCCH with TC-RNTI since MSG3, detects and decodes this message.

DCI Format 1_0 (scrambled with TC-RNTI = 0x4A3B): PDSCH allocation: RBs 5-40, MCS 4 HARQ Process ID: 0 New Data Indicator: 1 MAC PDU: ┌─────────────────────────────────────────────────┐ │ MAC CE: Contention Resolution Identity (48 bits)│ │ MAC SDU: LCID=1 (DCCH/SRB1) → RRCSetup │ │ Contains full radio config for the UE │ └─────────────────────────────────────────────────┘ UE sends HARQ ACK on PUCCH after successful decode
4d
UE Identity Verification (Contention Resolution)

The UE compares the Contention Resolution Identity in MSG4 with the CCCH SDU it sent in MSG3. If they match, contention resolution is successful. If another UE sent the same preamble and the gNB responded to that UE instead, the identity won't match — contention resolution fails.

Contention Resolution Check: MSG3 CCCH SDU (sent): 0x2D_6F_A3_B1_00_48 MSG4 CR Identity (rcvd): 0x2D_6F_A3_B1_00_48 ✓ MATCH — Contention Resolution Successful! If MISMATCH: → Contention resolution failed → Discard TC-RNTI, flush HARQ buffer → Restart RA from MSG1 with new random preamble → Apply backoff indicator if present
4e
C-RNTI Assignment & RRC Connected State

Upon successful contention resolution, the TC-RNTI is promoted to C-RNTI — the permanent cell-level identifier for this UE. The UE transitions to RRC_CONNECTED state, applies the received radio configuration, and sets up SRB1 for subsequent signaling.

Random Access Complete! TC-RNTI → C-RNTI: 0x4A3B (permanent identifier) RRC State: RRC_IDLE → RRC_CONNECTED UE applies masterCellGroup configuration: ✓ SRB1 established (DCCH, AM RLC) ✓ UL/DL BWP configured ✓ PHR (Power Headroom Report) timer started ✓ BSR (Buffer Status Report) configured ✓ SR (Scheduling Request) resources assigned Next: UE sends RRCSetupComplete on SRB1 (contains NAS message) Total RA latency: ~12ms (MSG1→MSG4, ideal conditions) ═══════════════════════════════════════════════════ RANDOM ACCESS PROCEDURE COMPLETE ✓ ═══════════════════════════════════════════════════
4f
Post-RA: What Happens Next?

After RA completion, the UE sends RRCSetupComplete containing the initial NAS message (e.g., Registration Request). The network then proceeds with authentication, security mode, and bearer setup. The RA procedure has served its purpose: the UE is now uplink-synchronized with dedicated resources.

The entire 4-step RA procedure typically completes in 10-15ms under ideal conditions. In congested cells, it may take 50-200ms due to backoff and retransmissions

Random Access Procedure Complete

The UE has successfully completed the 4-step RACH procedure and is now in RRC_CONNECTED state with C-RNTI 0x4A3B. All 28 sub-steps covered.

Total Latency
~12ms
Preamble Attempts
1
C-RNTI Assigned
0x4A3B
UE Distance
976m

Press "Reset" to restart the simulation or try "Contention-Free" mode

MSG1: Preamble (UL) MSG2: RAR (DL) MSG3: RRC Request (UL) MSG4: Resolution (DL)

5G Physical Layer Lab — Master PRACH, PDCCH, PDSCH, PUSCH & More

Go deeper into every channel you've seen in this RACH simulation. Our interactive lab covers 85 subtopics across 7 physical channels with step-by-step calculators, 3GPP references, and canvas visualizations — from Zadoff-Chu sequences to DMRS, LDPC coding, and resource mapping.

PRACH (11 topics) PDCCH (13 topics) PDSCH (17 topics) PUSCH (15 topics) PUCCH (12 topics) PBCH (12 topics) Fundamentals (5 topics)
Explore 5G PHY Layer Lab

You just walked MSG1 → MSG4. Now master the other 98 lessons.

Random Access is Module 6 of our flagship 5G NR Physical Layer · Advanced course — 99 cinematic, audio-narrated lessons covering every channel and signal in TS 38.211, from numerology and SSB to PDSCH, PUSCH, PRACH and CSI-RS.

6 modules · 99 lessonsTS 38.211 / 38.212 / 38.213 / 38.214Animated + narrated$29 lifetime
Explore the full course
Advanced Visualizations
9 interactive deep-dives into every aspect of the RACH procedure — resource grids, beam sweeping, protocol stacks, waveforms, and more
5G NR Time-Frequency Resource Grid — Watch how each RACH message occupies different physical resources in the radio frame. X-axis shows OFDM symbols (14 per slot), Y-axis shows Resource Blocks (RBs). PRACH uses dedicated frequency/time, PDCCH+PDSCH for downlink, PUSCH for uplink.
SSB Beam Sweeping → PRACH Occasion Mapping — Before RACH, the gNB sweeps 8 SSB beams across the cell. The UE measures RSRP on each beam, selects the strongest (best coverage), and maps it to the corresponding PRACH occasion. Each SSB index maps to specific PRACH time-frequency slots via ssb-perRACH-OccasionAndCB-PreamblesPerSSB.
Multi-UE Contention Scenario — 3 UEs attempt Random Access simultaneously. UE-A and UE-C randomly pick the same preamble (#37), causing a collision. The gNB detects both but can only resolve one. In MSG4, only UE-A's identity matches — UE-C's contention fails and must restart with backoff. UE-B picked a different preamble (#12) and succeeds independently.

UE Protocol Stack

RRCRadio Resource Control
PDCPPacket Data Convergence
RLCRadio Link Control
MACMedium Access Control
PHYPhysical Layer

gNodeB Protocol Stack

RRCRadio Resource Control
PDCPPacket Data Convergence
RLCRadio Link Control
MACMedium Access Control
PHYPhysical Layer
MSG1 — PRACH Preamble: RRC triggers RA procedure → MAC selects preamble & power → PHY generates Zadoff-Chu sequence → transmits on PRACH occasion. No PDCP/RLC involved (no user data yet).
Root Index (u): Length:
Zadoff-Chu Sequence Visualization — Top: Real & Imaginary parts of the ZC sequence in time domain. Bottom: Autocorrelation showing the sharp peak that enables preamble detection and Timing Advance estimation. The peak offset from center = round-trip propagation delay. x_u(n) = e^(-j*π*u*n*(n+1)/N_ZC), n = 0,1,...,N_ZC-1
Wireshark-Style Packet Dissector — Hover over bytes to see field details. Each color represents a different field in the MAC PDU. This is exactly what you'd see in a protocol analyzer or Wireshark capture.
RAR Timeout Scenario: UE sends preamble but gNB doesn't respond within ra-ResponseWindow. UE increases power by powerRampingStep (2dB) and retransmits with a new preamble. Shows power ramping across multiple attempts.
976 m
30 kHz (μ=1)
-110 dBm
120 dB
Interactive Parameter Explorer — Adjust sliders to see how parameters affect the RACH procedure in real-time. The canvas shows tower-UE with scaled distance, computed TA, power levels, and cell radius limits.
4-Step vs 2-Step Random Access — Side-by-side comparison. 4-Step (CBRA): MSG1→MSG2→MSG3→MSG4 (~12ms). 2-Step (introduced in Rel-16): MSGA (preamble+payload)→MSGB (response+resolution) (~6ms). 2-step RA reduces latency by combining MSG1+MSG3 into MSGA and MSG2+MSG4 into MSGB, ideal for URLLC.
Engineering Calculators
Professional 3GPP-compliant calculators for RA-RNTI, Timing Advance, PRACH Power, and Zadoff-Chu sequences

RA-RNTI Calculator

3GPP TS 38.321, Section 5.1.3
RA-RNTI = 1 + s_id + 14 × t_id + 14 × 80 × f_id + 14 × 80 × 8 × ul_carrier_id
1
RA-RNTI Value (Range: 1 - 65,535)

Timing Advance → Distance

3GPP TS 38.213, Section 4.2
d = (N_TA × T_c × c) / 2  |  N_TA = TA × 16 × 64 / 2μ
--
UE Distance from gNB

PRACH TX Power

3GPP TS 38.213, Section 7.4
P_PRACH = min(P_CMAX, preambleReceivedTargetPower + PL)
--
PRACH Transmit Power

Zadoff-Chu Cyclic Shift

3GPP TS 38.211, Section 6.3.3.1
Preambles/root = ⌊N_ZC / N_CS⌋  |  R_max = (N_CS × T_seq × c) / (2 × N_ZC)
--
Preambles per Root Sequence
TS 38.211 · TABLES 6.3.3.1-1 & 6.3.3.1-2
PRACH Preamble Formats — Complete Reference
All 13 NR preamble formats. Long formats use an 839-length Zadoff-Chu sequence for wide-area coverage; short formats use length 139 and slot-align with normal UL symbols — the workhorses of FR1 TDD and FR2 beam-swept deployments.
Long preamble formats — LRA = 839
FormatSCSSequenceCP lengthTotal durationMax cell radiusTypical use
01.25 kHz1 × 800 µs103.1 µs≈ 1.0 ms~14.5 kmLTE-refarmed macro cells, classic coverage
11.25 kHz2 × 800 µs684.4 µs≈ 3.0 ms~100.2 kmVery large / rural / maritime cells
21.25 kHz4 × 800 µs152.6 µs≈ 3.5 ms~22.1 kmCoverage extension via repetition gain (+6 dB)
35 kHz4 × 200 µs103.1 µs≈ 1.0 ms~14.5 kmHigh-speed UEs (≤ 500 km/h) — wider SCS resists Doppler
Short preamble formats — LRA = 139 · SCS = 15·2µ kHz (radii shown @ 15 kHz; halve per µ step)
FormatOFDM symbolsCP (κ units)Max cell radiusTypical use
A12288·2−µ0.94 kmSmall cells, dense urban
A24576·2−µ2.11 kmNormal urban cells
A36864·2−µ3.52 kmSuburban, the common FR1 TDD default
B12216·2−µ0.59 kmIndoor / hotspot — shortest format
B24360·2−µ1.05 kmCombined as A2/B2 in config tables
B36504·2−µ1.76 kmCombined as A3/B3 in config tables
B412936·2−µ3.87 kmBeam sweeping with many repetitions (FR2)
C011240·2−µ5.35 kmSingle-symbol with generous CP
C242048·2−µ9.30 kmLargest short-format radius

Rule of thumb: cell radius ≈ (CP − max delay spread) × c / 2. The preamble must arrive inside the CP window for the gNB correlator to detect it without inter-symbol interference.

TS 38.331 · RACH-ConfigCommon
The RACH Configuration — Every IE Decoded
SIB1 carries RACH-ConfigCommon inside the initial UL BWP. These are the fields a UE reads before its very first transmission — and the knobs an optimization engineer tunes.
Information ElementRangeWhat it controls
prach-ConfigurationIndex0…255Selects preamble format + which frames/subframes/slots contain PRACH occasions (TS 38.211 Tables 6.3.3.2-2/3/4)
msg1-FDM1 / 2 / 4 / 8Number of frequency-multiplexed PRACH occasions per time instance
msg1-FrequencyStart0…274Lowest PRB of the first PRACH occasion, relative to PRB 0 of the UL BWP
prach-RootSequenceIndex0…837 / 0…137Logical Zadoff-Chu root the cell starts from; consecutive roots are consumed until 64 preambles are generated
zeroCorrelationZoneConfig0…15NCS — cyclic-shift spacing between preambles. Larger NCS = larger cell radius but fewer preambles per root
preambleReceivedTargetPower−202…−60 dBmPower the gNB wants to receive MSG1 at — anchor of the open-loop power control formula
powerRampingStep0/2/4/6 dBIncrement added after each failed preamble attempt
preambleTransMaxn3…n200Max preamble attempts before the UE declares RACH failure to RRC
ra-ResponseWindowsl1…sl80How long the UE monitors PDCCH (RA-RNTI) for the RAR after MSG1
ssb-perRACH-OccasionAndCB-PreamblesPerSSB1/8…16Maps SSB beams → RACH occasions and splits the 64 preambles per SSB; this is how the gNB learns your best beam from MSG1 alone
ra-ContentionResolutionTimersf8…sf64How long the UE waits for MSG4 contention resolution after sending MSG3
rsrp-ThresholdSSB0…127Minimum SSB RSRP for a beam to be selectable for RACH
restrictedSetConfigunrestricted / typeA / typeBRestricted preamble sets for high-speed cells (Doppler-shifted correlation peaks)
msg3-transformPrecoderenabled / absentDFT-s-OFDM for MSG3 — lower PAPR for cell-edge UEs
When does a UE trigger Random Access? — TS 38.300 §9.2.6
EVENT 01

Initial access from RRC_IDLE

The very first thing a phone does on a 5G cell after reading SIB1 — no uplink timing exists yet.

EVENT 02

RRC Connection Re-establishment

Recovering from radio link failure — the UE must re-acquire UL sync before it can tell the network what happened.

EVENT 03

Handover

Arriving at the target cell. Usually contention-free: the target gNB pre-allocates a dedicated preamble in the HO command.

EVENT 04

DL data, UL out-of-sync

Data arrives for you but your timing-advance timer expired — the gNB orders RACH via PDCCH (contention-free).

EVENT 05

UL data, UL out-of-sync

You have data to send but lost sync, or have no PUCCH resources for a Scheduling Request.

EVENT 06

SR failure

Scheduling Requests exhausted (sr-TransMax reached) with no grant — RACH is the fallback.

EVENT 07

Transition from RRC_INACTIVE

Resuming a suspended connection — MSG3 carries RRCResumeRequest with the I-RNTI.

EVENT 08

Beam Failure Recovery

All serving-beam candidates failed; the UE RACHes on the occasion mapped to a new candidate beam (Rel-15 BFR).

EVENT 09

On-demand SI request

Requesting an SIB the cell doesn't broadcast — MSG1-based or MSG3-based SI request.

EVENT 10

Positioning

UL time-alignment needed for positioning measurements (Rel-16).

Role-Based Engineering Guide
What to check and how to check — tailored for your role in the 5G ecosystem
Developer
UE Tester
Optimization

PRACH Configuration

  • Verify prach-ConfigurationIndex maps to correct PRACH format and occasion in TS 38.211 Table 6.3.3.2-2/3/4
  • Validate rootSequenceIndex (0-837 for L=839) and ensure no collision between neighboring cells
  • Check zeroCorrelationZoneConfig (N_CS) matches cell radius requirement
  • Confirm restrictedSetConfig (unrestricted/typeA/typeB) for high-speed scenarios
  • Validate msg1-SubcarrierSpacing alignment with BWP SCS

Timing & Windows

  • Set ra-ResponseWindow (1-40 slots) — too short causes missed RAR, too long wastes resources
  • Configure ra-ContentionResolutionTimer (8-64 subframes) per expected MSG4 delay
  • Validate preambleTransMax (3-200) for max retransmission attempts
  • Implement correct RAPID (RA Preamble ID) matching in RAR MAC PDU parsing
  • Handle backoffIndicator (0-960ms) random backoff correctly per TS 38.321

Power Control & HARQ

  • Implement preambleReceivedTargetPower (-202 to -60 dBm) open-loop power control
  • Apply powerRampingStep (0/2/4/6 dB) on each retransmission
  • Handle HARQ for MSG3: retransmit on NACK with same HARQ process ID
  • Validate TA application: N_TA = TA_command × 16 × 64 / 2^μ T_C units
  • Implement contention-free RA (CFRA) with dedicated preamble assignment via ra-PreambleIndex

Common Bugs to Watch

  • RA-RNTI calculation off-by-one: Remember it starts at 1, not 0
  • MSG3 buffer size: Ensure CCCH SDU fits in UL grant allocation
  • Timer race: ra-ResponseWindow starts at end of preamble TX, not beginning
  • Preamble group mismatch: Group A vs Group B threshold messageSizeGroupA
  • SSB-to-PRACH mapping: PRACH occasion must map to correct SSB index

MSG1 Preamble Tests

  • TC1: Verify UE selects preamble from Group A when pathlossThreshold not exceeded
  • TC2: Verify Group B selection when PL > threshold and MSG3 size > messageSizeGroupA
  • TC3: Validate PRACH power: initial power = target + PL, capped at P_CMAX (23 dBm)
  • TC4: Power ramping: each retx increases by powerRampingStep dB
  • TC5: Verify UE transmits on correct PRACH occasion (time/freq) per SSB mapping

MSG2 RAR Tests

  • TC6: UE monitors PDCCH with RA-RNTI during ra-ResponseWindow
  • TC7: UE correctly decodes RAR MAC PDU: TA + UL Grant + TC-RNTI
  • TC8: If no RAR received within window, UE retransmits preamble with power ramp
  • TC9: Backoff indicator handling: random wait within [0, BI] before retry
  • TC10: Verify TA application in MSG3 transmission timing

MSG3/MSG4 & Contention

  • TC11: MSG3 contains correct identity (S-TMSI for registered, random for initial)
  • TC12: MSG3 HARQ retransmission on NACK within contention resolution timer
  • TC13: Contention resolution: UE matches identity in MSG4 vs MSG3
  • TC14: On contention failure, UE restarts RA with new preamble + backoff
  • TC15: After max retries (preambleTransMax), UE declares RA failure to upper layers

UE Log Analysis Tips

  • Filter logs for RACH_IND, RAR_RECEIVED, CR_TIMER_EXPIRY
  • Check PRACH_TX_POWER — should ramp on each attempt
  • Verify RAPID in RAR matches transmitted preamble index
  • Monitor BLER on MSG3/MSG4: high BLER indicates coverage or interference issue
  • Capture air interface: PRACH preamble in time-frequency grid for format validation

KPIs to Monitor

  • RACH Success Rate: Target >99%. = (Successful RA / Total RA attempts) × 100
  • RACH Access Delay: Target <50ms. Time from MSG1 TX to MSG4 RX
  • Preamble Collision Rate: Monitor via detected preamble count vs successful RA
  • Mean Preamble Attempts: Target <1.5. High value = congestion or coverage issue
  • MSG2/MSG3/MSG4 Success Rates: Identify which step is the bottleneck

Parameter Tuning

  • High load: Increase PRACH occasions (more slots/freq), reduce preamble groups overlap
  • Large cells: Increase zeroCorrelationZoneConfig for larger N_CS → larger cell radius support
  • Coverage issue: Lower preambleReceivedTargetPower, increase preambleTransMax
  • Congestion: Enable ssb-perRACH-OccasionAndCB-PreamblesPerSSB tuning
  • High-speed: Switch to restrictedSetConfig = typeA or typeB

Root Cause Analysis

  • MSG1 failure: Check RSRP/SINR at cell edge, PRACH power settings, interference from neighbor PRACH
  • MSG2 failure: Check PDCCH/PDSCH BLER, RA-RNTI calculation, ra-ResponseWindow too short
  • MSG3 failure: Check UL grant size, TA accuracy, PUSCH BLER, UL interference
  • MSG4 failure: Check DL BLER, contention resolution timer, high load → collision
  • Frequent RA restarts: Check for ping-pong handover, SCell activation loops, beam failure recovery

Optimization Workflow

  • Step 1: Collect counters: RACH attempts, success, MSG2/3/4 failures per cell
  • Step 2: Identify worst cells by success rate. Correlate with PRB utilization and user count
  • Step 3: For coverage cells: drive test with PRACH measurements, check SSB RSRP at failure location
  • Step 4: For capacity cells: increase PRACH occasions, tune preamble allocation, enable 2-step RA
  • Step 5: Verify improvement: compare KPIs pre/post change over 7-day window

Ready to Master 5G Physical Layer?

Everything you've explored here — PRACH preambles, Zadoff-Chu sequences, resource grids, TA estimation, power control — is covered in depth in our interactive lab. Each topic has visual calculators, animated diagrams, and direct 3GPP TS references. Ideal for developers, testers, and optimization engineers.

Start 5G PHY Layer Lab 85 Interactive Topics • Canvas Visualizations • 3GPP References • Free Access
From the CafeTele Academy

RACH is one chapter.
Master the entire physical layer.

Everything on this page — preamble design, RA-RNTI, beam-mapped occasions, MSG3 precoding — is taught in full cinematic depth in our flagship 5G NR Physical Layer · Advanced course: 99 animated, audio-narrated lessons engineered straight from TS 38.211–38.214. No fluff, no hand-waving — the same rigor as this tool, across every channel and signal.

Module 1 · NR fundamentals & numerology (9) Module 2 · PDSCH · PDCCH · PBCH (39) Module 3 · PUSCH · PRACH · PUCCH (38) Module 4 · DMRS · CSI-RS · SRS · PT-RS (6) Module 5 · Cell search · MIB · SIB1 (6) Module 6 · Random Access — this topic! (6)
Prefer live, in-person training? We run corporate workshops & consultancy worldwide — +91-70914-33763 · [email protected]
$49
$29 / ₹2,449
One payment · Lifetime access
  • 99 cinematic lessons across 6 modules
  • Grounded in TS 38.211 / 212 / 213 / 214
  • Audio narration + hand-built animations
  • All future lessons & updates included
  • Team licenses & invoice billing available
Get the full course → View the 99-lesson syllabus
3GPP References
Authoritative 3GPP Technical Specifications for Random Access

TS 38.211

Physical channels and modulation — PRACH signal generation, preamble sequence, time-frequency structure

TS 38.213

Physical layer procedures — PRACH occasions, power control, RA-RNTI, Timing Advance

TS 38.321

MAC specification — Random Access procedure, RAR parsing, contention resolution, backoff

TS 38.331

RRC specification — RACH-ConfigCommon, RACH-ConfigDedicated, BWP configuration for RA

Engineers ask
Frequently Asked Questions
The questions 5G engineers actually search for — answered at spec level.
What is the 5G NR Random Access (RACH) procedure?
It is the 4-step handshake (MSG1 preamble → MSG2 RAR → MSG3 RRC request → MSG4 contention resolution) by which a UE acquires uplink time synchronization and a C-RNTI from the gNB. It is the first uplink transmission a phone ever makes on a cell, and it is defined across TS 38.321 (MAC), TS 38.211 (PRACH signal) and TS 38.213 (procedures). Use the live simulation above to step through it.
How is RA-RNTI calculated in 5G NR?
RA-RNTI = 1 + s_id + 14·t_id + 14·80·f_id + 14·80·8·ul_carrier_id, where s_id is the first OFDM symbol of the PRACH occasion (0–13), t_id the first slot in the system frame (0–79), f_id the frequency-domain occasion index (0–7) and ul_carrier_id 0 (NUL) or 1 (SUL). The UE computes it from where it sent the preamble, then monitors PDCCH for that RNTI. Try the RA-RNTI calculator above.
What is the difference between 4-step and 2-step Random Access?
2-step RA (Rel-16) collapses MSG1+MSG3 into MSGA (preamble + PUSCH payload sent together) and MSG2+MSG4 into MSGB, cutting access latency roughly in half (~12 ms → ~6 ms) at the cost of transmitting the payload before any timing advance is known — so it suits small cells and good-SINR UEs, and is selected via an RSRP threshold (msgA-RSRP-Threshold). Watch them race in the 4-step vs 2-step visualization.
What causes RACH failure in 5G NR?
The classics: preamble received below detection threshold (fix preambleReceivedTargetPower / powerRampingStep), root-sequence collisions between neighbor cells (re-plan prach-RootSequenceIndex), NCS too small for the actual cell radius (ghost preambles from cyclic-shift ambiguity), RAR window too short for high PDCCH load, MSG3 BLER from aggressive grants, and preamble collisions under high contention (too few occasions — increase msg1-FDM or the configuration index density).
How does Timing Advance work in 5G RACH?
The gNB measures the preamble's arrival offset inside the PRACH occasion and quantizes it into an 11-bit TA command (0–3846) in the RAR: TTA = NTA·16·64·Tc/2µ. The UE advances its uplink by that amount so all UEs' transmissions arrive symbol-aligned at the gNB regardless of distance. One TA step at 15 kHz SCS ≈ 0.52 µs ≈ 78 m of radius.
Which PRACH preamble format should I choose?
Match the CP to your cell radius and the SCS to your Doppler: Format 0 for classic macro (≤14.5 km), Format 1 for very large rural cells (≤100 km), Format 2 when you need repetition gain, Format 3 for high-speed lines. For FR1 TDD small/medium cells A3 is the common default; B4 and C2 dominate FR2 beam-swept deployments. Full tables in the formats reference above.
How are the 64 preambles split between SSB beams, CBRA and CFRA?
ssb-perRACH-OccasionAndCB-PreamblesPerSSB maps N SSBs to each RACH occasion and reserves a contention-based subset per SSB; totalNumberOfRA-Preambles caps the CBRA pool and the remainder is available for contention-free assignment (handover, BFR, PDCCH order). Because the preamble itself identifies the SSB, the gNB knows your best downlink beam from MSG1 alone — before you have ever said a word.
Where can I learn the full 5G NR physical layer in this depth?
This page is built by the team behind the 5G NR Physical Layer · Advanced course — 99 animated, narrated lessons over 6 modules (numerology, PDSCH/PDCCH/PBCH, PUSCH/PRACH/PUCCH, reference signals, cell search, and random access), $29 lifetime. For corporate on-site training: [email protected].