Programmatically update alt tag on image field
As @clive suggested use $node-&gt;save();. Without node saving, alt of the image will not show up in the edit form.

$nids = \Drupal::entityQuery('node')-&gt;condition('type','sfa_social_post')-&gt;execute();
$nodes = \Drupal\node\Entity\Node::loadMultiple($nids);
foreach ($nodes as $node) {
  $node-&gt;field_sfa_image_file-&gt;alt = 'Image for ' . $node-&gt;getTitle();
  $node-&gt;save();
}