Animals are fitted with a collar that emits an audio tone (AT, rising pitch, 5-20 s), followed by a weak electric pulse (EP, 0.2 Joule, 1 s) when they cross a digital boundary tracked by global positioning: virtual fencing (VF) opens up the possibility of replacing physical fences, thereby reducing manual labor for farmers. However, its application raises concerns on animal ethics. A VF system was used on a Swiss dairy farm to follow the learning process of cows and to determine their stress responses compared to cows managed with electric fences (EF). Twenty lactating cows (3.7±1.5 lactations, 203±62 DIM), naïve to VF, were divided into 4 homogeneous groups of 5 individuals (2x VF; 2x EF). Each group grazed in a separate paddock during 3 days of acclimation (P0), followed by 4 periods (P1-4) of 21, 14, 14, and 7 days, respectively. All paddocks were electrically fenced, comparable in size and of similar topography and vegetation. During P0, all cows became accustomed to wearing an IceQube pedometer (Peacock Technology Ltd, Stirling, UK) and a deactivated VF collar (Nofence AS, Batnfjordsøra, Norway). During P1-P4, a virtual boundary was activated for the VF groups. Throughout the experiment, the sensors continuously tracked cow positions and activity behavior at 15-min intervals. From P1, the collars additionally recorded each AT and EP per cow. During P0-P4, individual feed intake was recorded daily in the barn, as well as milk yield and body weight twice per day. A total of 26 milk samples were collected per cow to examine milk cortisol after grazing. Observations were conducted for 2 h on 23 days to record agonistic behaviors, vocalizations, and excretions. The mean relative distances of the cows from the exclusion zones were determined depending on the maximum distance from the VF or EF (in %), respectively. During 56 days, each cow received a mean of 1.9±3.3 AT and 0.1±0.7 EP per day. The mean number of EP (n = 8) decreased by 74 % from Day 1 to 3 and remained below a mean daily level of 0.4 EP per cow for the remaining experiment. All cows learned to cope with the VF-system, as indicated by a decreasing ratio of mean EP/AT from 0.2 to 0.03, 0.02 and 0 in P1-4, respectively. Milk yield and cortisol, feed intake, body weight, and activity behaviors did not significantly differ between VF and EF groups. Overall, there were a mean of 11.2 vocalizations and 5.9 displacements more per cow in the VF groups (p < 0.05), but without differences between P0-P4. The mean relative distance of the cows to the exclusion zones was similar between EF (42±1.3 %) and VF groups (42±1.4 %) within the 59 days of experiment. The cows adapted to the VF-system without evidence of lasting adverse effects on animal welfare. Based on individual learning ability, sufficient training of the animals by at least 3 repetitions at a new virtual boundary, each maintained for at least 3 days, seem to be appropriate for the conditioning at herd level.