Skip to content
View in the app

A better way to browse. Learn more.

Ham Radio Base -Powered By Ham CQ DX

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Solar
SFI 125
SN 85
A 7
K 2 Quiet
X-Ray C1.9
Wind 445.8 km/s
Aurora 2
Updated 00:30 UTC HamQSL · N0NBH
Day 80/40m Fair 30/20m Good 17/15m Good 12/10m Fair
Night 80/40m Good 30/20m Good 17/15m Good 12/10m Poor

Callsign Lookup
_
Vanity Call Signs Available
Enter filters above and click Search.
ⓘ Callsign lookups are in real time via the FCC database. Vanity callsign availability is refreshed daily at 6:00 AM CST. The vanity search may be unavailable for a few minutes during this update.
Live DX spots
Live DX Spots — 70cm via PSKReporter · scroll or pinch to zoom
Band
Mode
Time
Loading map data…
MHz DX Spotter Info
Recent spots
Select a band above to load spots
Ready — select a band to fetch live spots

Antenna Build Guides 4nec2 Antenna Modelling Guide

Antenna Modelling with 4nec2 — Complete Guide for Ham Radio

A complete practical guide to 4nec2 for amateur radio antenna design and optimisation. Covers the 4nec2 interface, writing and importing NEC input files, using variables for parametric models, the built-in genetic algorithm optimiser for automated element tuning, reading 2D and 3D pattern plots, frequency sweeps, and practical workflows for designing Yagis, dipoles, verticals, and loop antennas from scratch.

Free4nec2 — no licence required
NEC2/4Supported simulation engines
GABuilt-in genetic algorithm optimiser
VariablesParametric modelling support
WindowsPrimary platform (Wine on Linux/Mac)

What makes 4nec2 different

4nec2, developed by Arie Voors, is a free Windows application for antenna modelling using the NEC2 and NEC4 simulation engines. Where EZNEC emphasises a clean graphical interface for entering antenna geometry interactively, 4nec2 works primarily with NEC input files — text files containing the wire geometry, source, ground, and frequency data in the NEC card format. This text-based approach gives 4nec2 several capabilities that EZNEC lacks: variable support for parametric models, a built-in optimiser that can automatically adjust specified variables to meet performance targets, and the ability to handle very large and complex models limited primarily by available system memory.

The trade-off is a steeper initial learning curve. A new user opening 4nec2 for the first time faces a less intuitive interface than EZNEC and must understand at least the basics of NEC card syntax to build models from scratch. Most experienced 4nec2 users start by importing existing NEC files — either from the extensive community model library or exported from EZNEC — and learn the card format by reading and modifying working models rather than entering geometry from scratch. For operators who want to design optimised Yagis, the optimiser capability alone makes the learning investment worthwhile.

When to use 4nec2 over EZNEC

Use 4nec2 when the primary goal is Yagi design or any antenna where element dimensions need systematic optimisation to meet specific performance targets. The genetic algorithm optimiser can simultaneously vary multiple element lengths and spacings to maximise forward gain, maximise F/B ratio, achieve a specified feedpoint impedance, or optimise any combination of these within user-specified constraints. A three-element Yagi that would take an experienced EZNEC user hours of manual trimming to optimise can be automatically optimised by 4nec2 in minutes.

4nec2 is also the better choice for parametric modelling — exploring how performance changes as a variable sweeps across a range. Want to know how a dipole's gain and feedpoint impedance vary as height increases from 5 to 25 metres? Define height as a variable, set up a sweep, and 4nec2 plots the result across the full range in one run. This capability makes 4nec2 the preferred tool for antenna research and comparative design work, while EZNEC remains more convenient for quick single-model evaluation.

4nec2 vs EZNEC at a glance: Feature 4nec2 EZNEC ───────────────────────────────────────── Cost Free Free (EZNEC+ now free) Interface Text+GUI GUI Variables Yes No Optimiser Yes (GA) No NEC card editing Yes Limited Segment limit Memory 500 (Demo), 1500 (+) Beginner friendly Moderate High Community models Extensive Good Linux (Wine) Yes Yes

Installing 4nec2

4nec2 is available as a free download from its official site at 4nec2.nl. Download the installer package — the current version includes the NEC2 engine and optionally the NEC4 engine for more complex models. Run the installer with administrator privileges. 4nec2 installs to a user-specified directory and creates a shortcut on the desktop. The installation includes a library of sample NEC files covering common antenna types — dipoles, Yagis, loops, verticals, and more — that serve as excellent learning examples.

On Linux and macOS, 4nec2 runs under Wine with minor configuration. Install Wine, download the 4nec2 Windows installer, and run it through Wine. The graphical interface and 3D pattern display work correctly in most Wine environments. The optimiser functions are compatible. The main limitation on Linux is that some Windows fonts may not render correctly, which affects the display of some plot labels but does not affect simulation results.

The NEC card format — understanding the basics

A NEC input file is a plain text file containing a sequence of two-letter command cards, each specifying one aspect of the antenna model. The most important cards for amateur antenna modelling are GW (geometry wire), GE (geometry end), EX (excitation — the source), GN (ground), FR (frequency), and RP (radiation pattern request). Each card has a specific column format for its parameters. Understanding these six card types is sufficient to read and modify most amateur antenna NEC files.

NEC card format — key cards: GW tag segs x1 y1 z1 x2 y2 z2 radius tag = wire identifier number segs = number of segments x1,y1,z1 = start coordinates (metres) x2,y2,z2 = end coordinates (metres) radius = wire radius (metres) EX 0 tag seg 0 1 0 Voltage source on wire 'tag', segment 'seg' GN 2 0 0 0 σ ε Real ground: σ=conductivity, ε=dielectric const FR 0 1 0 0 freq 0 Single frequency simulation at 'freq' MHz GE 1 End geometry (with ground plane if arg=1)

NEC Model Segment Density and Validation Calculator

Calculate the correct number of segments for a wire element and validate segment length against NEC2 requirements. Enter the wire length and operating frequency.

Creating a 3-Element 20m Yagi in 4nec2

A walkthrough covering NEC file creation, variable-based parametric setup, simulation, and optimiser use. The Yagi is the antenna where 4nec2's optimiser delivers its greatest value.

1

Open 4nec2 and create a new NEC file

Launch 4nec2 and click File → New. The NEC editor window opens — a text editor with syntax highlighting for NEC card keywords. You will type the antenna model directly as NEC cards. 4nec2 also has a geometry editor (accessible via Edit → NEC editor → Geometry) that provides a graphical wire entry interface similar to EZNEC, but most experienced 4nec2 users work directly with the card editor because variable support requires text-based card entry. Start by entering comment lines — lines beginning with CM — to document the model.

Tip: Save the NEC file with a .nec extension immediately after creating it. 4nec2 associates .nec files with its application, and having a saved file makes it easy to reload after crashes or to compare different versions by saving incrementally as model_v1.nec, model_v2.nec and so on.
2

Define variables for parametric modelling

4nec2 supports variables in NEC files through SY (symbol) cards placed before the geometry. Variables are referenced throughout the wire geometry cards using their names, making it trivial to change a dimension globally — for example, changing element spacing by editing one SY card rather than recalculating and re-entering every wire endpoint. Define variables for all key Yagi dimensions: reflector length, driven element length, director length, and the spacings between elements.

Example SY variable block for 20m 3-el Yagi: SY refl=5.10 ' reflector half-length (m) SY de=4.85 ' driven element half-length (m) SY dir=4.50 ' director half-length (m) SY sp1=3.70 ' reflector to DE spacing (m) SY sp2=2.65 ' DE to director spacing (m) SY ht=12.0 ' antenna height (m) SY dia=0.0125 ' element radius 25mm tube (m) Then reference in GW cards: GW 1 21 -refl 0 ht refl 0 ht dia ' reflector GW 2 21 -de 0 ht de 0 ht dia ' driven elem GW 3 21 -dir 0 ht dir 0 ht dia ' director Note: DE is at x=0; reflector at x=-sp1; director at x=sp2. Adjust x coordinates.
3

Complete the NEC file structure

After the SY variable block and GW wire cards, add the remaining required cards. GE 0 ends the geometry section. EX 0 places the voltage source on the driven element — specify the driven element wire tag and the centre segment. GN 2 sets real ground with typical conductivity 0.005 and dielectric constant 13. FR 0 sets the simulation frequency to 14.175 MHz. RP 0 requests the radiation pattern calculation with elevation and azimuth resolution of 1 degree. EN ends the file.

Tip: Use the Check button in 4nec2 to validate the NEC file before running a simulation. The checker identifies card syntax errors, segment length violations, and geometry problems such as wires that should be connected but are not quite touching. Fixing these before running saves time compared to diagnosing errors from unexpected simulation results.
4

Run the initial simulation and read results

Click Calculate → Run NEC or press F7. 4nec2 runs the NEC2 engine and displays results in the main window. Click Far Field Pattern to see the radiation pattern. Click Data to see feedpoint impedance — the complex impedance Z = R + jX will be displayed for the source. Note the maximum gain in dBi, the F/B ratio (difference in gain between 0 and 180 degrees in the azimuth plot), and the feedpoint impedance. For a three-element 20m Yagi at the starting dimensions the gain should be around 7 to 8 dBi, F/B around 15 to 20 dB, and feedpoint impedance around 20 to 30 ohms resistive.

5

Set up the optimiser for automatic element tuning

Click Optimise → Settings. In the optimiser dialog, select the variables to optimise — typically refl, de, dir, sp1, sp2. Set minimum and maximum values for each variable to constrain the search within physically reasonable bounds. For example, constrain refl between 4.8 and 5.4 metres, de between 4.5 and 5.2 metres, sp1 between 2.5 and 5.0 metres. Define the optimisation goal — options include maximise gain, maximise F/B, minimise SWR, or a weighted combination. Set the number of generations and population size for the genetic algorithm — 50 generations with a population of 100 is a reasonable starting point that completes in a few minutes on modern hardware.

Note: The genetic algorithm optimiser is stochastic — it produces slightly different results on each run due to random initialisation. Run the optimiser two or three times and compare the results. If the optimised values converge to similar results across runs, the global optimum has likely been found. If results vary widely, increase the population size or number of generations.
6

Run the optimiser and apply results

Click Optimise → Start. The optimiser runs the NEC engine repeatedly — hundreds to thousands of times — evaluating each candidate antenna configuration against the specified goal. The progress display shows the improving performance score with each generation. When complete, 4nec2 displays the optimised variable values that achieved the best result. Review the values for physical reasonableness — dimensions outside practical construction tolerances or that require very thin or very thick element spacing may indicate the optimiser found a local rather than global optimum.

Apply the optimised values by updating the SY cards in the NEC file and running a final simulation to confirm the performance. View the final radiation pattern, confirm the F/B ratio and gain, and check the feedpoint impedance. If the impedance is far from the target — for example 15 ohms when a hairpin match designed for 25 ohms is intended — constrain the impedance in the next optimiser run by adding it to the optimisation goals with appropriate weighting.

7

Run a frequency sweep to check bandwidth

Change the FR card to request a frequency sweep across the full 20m band. Replace the single-frequency FR card with a multi-step version specifying start frequency, step size, and number of steps. 4nec2 runs the simulation at each frequency and plots SWR, gain, and impedance across the sweep range. A well-designed three-element Yagi should show SWR below 2:1 across most of the 20m phone band — 14.150 to 14.350 MHz — when matched with a hairpin or beta match tuned to the optimised feedpoint impedance.

Frequency sweep FR card syntax: FR 0 nfreqs 0 0 start_freq step_MHz Example — sweep 14.0 to 14.35 MHz, 8 steps: FR 0 8 0 0 14.0 0.05 This produces simulation at: 14.000, 14.050, 14.100, 14.150, 14.200, 14.250, 14.300, 14.350 MHz View SWR plot: Calculate → SWR

The geometry editor

For operators who prefer a graphical wire entry interface, 4nec2 includes a geometry editor accessible through the Edit menu. The geometry editor allows wires to be added, moved, and deleted visually, with the NEC card file updated automatically as changes are made. It includes a 3D preview of the antenna structure that updates in real time as wires are added, making it easy to verify that the geometry is correct before running the simulation engine. The geometry editor is the quickest starting point for new models when variables and parametric sweeps are not required.

The geometry editor and the NEC card editor are fully synchronised — changes made in one are immediately reflected in the other. This allows operators to rough out a geometry graphically and then switch to the card editor to add variable definitions, refine coordinates, and set up optimiser parameters. The hybrid workflow — graphical entry followed by text-based refinement — is effective for complex antennas that would be tedious to enter from scratch in card format.

The 3D pattern viewer

4nec2's 3D pattern display renders the antenna radiation pattern as a shaded 3D surface that can be rotated, zoomed, and inspected from any angle. The colour coding maps gain values to a spectrum — typically blue for low gain and red for peak gain — making it immediately apparent where the antenna radiates most strongly and where the nulls fall. The 3D viewer is particularly useful for antennas with complex three-dimensional patterns, such as crossed Yagis, phased arrays, and antennas at low height where ground interaction produces a complex elevation structure.

The viewer can overlay the antenna wire structure on the pattern display, showing the physical antenna within its radiation envelope. Rotating this combined view while varying antenna height or element dimensions builds an intuitive understanding of how geometry drives pattern shape that is difficult to develop from 2D plot reading alone. Export the 3D pattern view as an image for documentation or publication directly from the viewer menu.

Loading impedance and transmission line modelling

4nec2 supports lumped loading — resistors, inductors, and capacitors — placed at specific segments through the LD card. This allows modelling of loading coils in short verticals, trap elements in multiband antennas, and termination resistors in terminated folded dipoles like the T2FD. The LD card specifies the load type, the wire and segment location, and the component values. Combined with the frequency sweep capability, loaded antenna models can be evaluated across their full operating bandwidth showing how the loading affects resonance, impedance, and gain at each frequency.

Transmission line modelling is supported through the TL card, which models an ideal lossless transmission line between two points in the antenna structure. This is useful for modelling phasing lines in phased vertical arrays, matching stubs, and the transmission-line sections in Yagi matching systems. The TL card requires the characteristic impedance and electrical length of the line — values that can be computed from the coax velocity factor and physical length using the calculator on the coax comparison guide.

Importing and sharing NEC models

4nec2 reads standard NEC input files (.nec, .txt, .ez formats) and can import EZNEC .ez files directly. The extensive community library of NEC files available from antenna modelling websites, the ARRL Antenna Book supplemental files, and modelling-focused amateur radio clubs provides a ready source of validated starting models. Importing a known-good model for a similar antenna type and modifying its dimensions for a different frequency is often more productive than building from scratch.

4nec2 models can be exported as standard NEC files and shared with any NEC-compatible simulation tool including EZNEC, MMANA-GAL, and web-based NEC calculators. The variable definitions in SY cards are preserved in the exported file, but non-4nec2 tools may not support variables and will require the variables to be substituted with their numeric values before import. The 4nec2 file menu includes an option to expand all variables to constants for maximum compatibility with other tools.

Card Purpose Key parameters Example Notes
CMCommentFree textCM 3-element 20m YagiUse for documentation; ignored by engine
SYVariable definitionname=valueSY refl=5.104nec2 extension; not standard NEC
GWDefine wiretag segs x1 y1 z1 x2 y2 z2 radGW 1 21 -5.03 0 10 5.03 0 10 0.001Coordinates in metres; radius in metres
GEEnd geometry0 or 1GE 0Use GE 1 if ground plane symmetry used
EXExcitation sourcetype tag seg 0 voltage 0EX 0 2 11 0 1 0Type 0 = voltage source; seg = centre segment
GNGroundtype nrad eps sigmaGN 2 0 0 0 0.005 13Type 2 = Sommerfeld real ground
FRFrequency0 nfreq 0 0 start stepFR 0 1 0 0 14.175 0Single freq if nfreq=1; sweep if nfreq>1
LDLumped loadtype tag seg 0 R L CLD 0 1 5 0 10 0.001 0R in ohms, L in henries, C in farads
TLTransmission linetag1 seg1 tag2 seg2 Z0 lenTL 2 11 3 11 50 5.0Z0 in ohms; len in metres electrical length
RPRadiation pattern0 ntheta nphi 1000 theta_start phi_start dtheta dphiRP 0 181 361 1000 0 0 1 11-degree resolution; takes longer to compute
ENEnd of filenoneENMust be last card in file

Is 4nec2 better than EZNEC for beginners?

EZNEC is more beginner-friendly due to its graphical wire entry interface and cleaner Windows UI. 4nec2 has a steeper initial learning curve because it works primarily with NEC card files. However, 4nec2 is free, has no segment limits beyond available RAM, includes a powerful optimiser, and supports parametric variable modelling — advantages that make the learning investment worthwhile for anyone who intends to design rather than just evaluate antennas. Starting with EZNEC to learn NEC concepts and then moving to 4nec2 for optimisation work is a common and effective progression.

How does the genetic algorithm optimiser work?

The genetic algorithm creates a population of candidate antenna configurations — each with slightly different values for the specified variable dimensions — and evaluates each against the performance goal using the NEC engine. The best-performing configurations are selected as parents for the next generation, with random mutations introduced to explore new areas of the solution space. Over many generations the population converges toward the optimal configuration. The process mimics biological evolution and is effective at finding global optima in multi-dimensional design spaces where manual tuning would miss the best solution.

Can 4nec2 model antennas with insulated wire?

NEC2 does not model insulation directly — it assumes bare conductors in free space or over ground. Insulated wire has a slightly different velocity factor than bare wire, causing the antenna to resonate at a lower frequency than the bare-wire model predicts. The practical correction is to cut the wire 2 to 5 percent longer than the NEC model suggests and trim to resonance using a NanoVNA after construction. For EFHW and end-fed antennas where insulated wire is common, this correction is particularly important.

What is a good number of segments for a typical HF dipole?

For a half-wave dipole on 20m (total length ~10 metres), 21 segments — 11 per arm with a shared feedpoint — is the standard starting point. This gives segment lengths of approximately 0.45 metres, or about 2 percent of the wavelength — well within the NEC2 valid range of 0.1 to 10 percent of a wavelength. Using an odd number of segments per arm ensures a segment boundary falls exactly at the feedpoint junction, which is required for accurate source placement and impedance calculation.

How do I model a vertical with buried radials in 4nec2?

Buried radials are modelled as wires below ground level — negative Z coordinates. 4nec2 with the Sommerfeld-Norton ground model handles buried wires correctly, computing the current distribution in the radial system and its effect on the vertical's radiation pattern and feedpoint impedance. Model each radial as a GW card extending from the base of the vertical outward at a depth of 5 to 10 cm below ground. The ground conductivity has a much larger effect on the modelled results for ground-mounted verticals than for horizontal dipoles — vary the ground parameters to understand the sensitivity of your design to soil quality.

Can I run 4nec2 models on Linux without Wine?

4nec2 itself requires Wine on Linux as it is a Windows application. However, the underlying NEC2 simulation engine is available as a native Linux command-line program and can be run directly. The NEC2 engine takes a standard .nec input file and produces output files that can be parsed with Python or other scripting tools. Several Linux-native NEC front-ends also exist including xnec2c, which provides a graphical interface to NEC2 on Linux without Wine. xnec2c does not include 4nec2's optimiser but covers most routine modelling tasks.

How do I convert an EZNEC model to 4nec2 format?

EZNEC can export models as NEC input files — use File → Export → NEC Input File. The resulting .nec file can be opened directly in 4nec2. The export converts EZNEC's graphical wire entries to GW cards with numeric coordinates. Variables are not preserved since EZNEC does not support them — the exported file uses fixed numeric values. After importing, add SY variable definitions at the top of the file and replace the relevant numeric values in the GW cards with variable references to enable parametric sweeps and optimisation.

What is the maximum antenna complexity 4nec2 can handle?

4nec2's segment limit is bounded by available system RAM rather than a fixed software limit. On a modern PC with 8 GB of RAM, models with 10,000 to 50,000 segments are feasible, though simulation time increases significantly with segment count. For amateur radio purposes — even complex phased arrays, stacked Yagis, or large log periodics — 4nec2 handles all practical designs without segment count becoming a constraint. The NEC4 engine option in 4nec2 Pro extends accuracy for certain antenna types including antennas with buried elements and antennas near lossy ground.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.