diff --git a/nullability/inference/eligible_ranges.cc b/nullability/inference/eligible_ranges.cc
index d084f70..045fb27 100644
--- a/nullability/inference/eligible_ranges.cc
+++ b/nullability/inference/eligible_ranges.cc
@@ -7,6 +7,7 @@
 #include <cassert>
 #include <optional>
 #include <string_view>
+#include <utility>
 #include <vector>
 
 #include "nullability/inference/inferable.h"
@@ -67,7 +68,9 @@
 
 static void initSlotRange(SlotRange &R, std::optional<SlotNum> Slot,
                           unsigned Begin, unsigned End,
-                          std::optional<NullabilityKind> Nullability) {
+                          std::optional<NullabilityKind> Nullability,
+                          std::optional<int> AnnotationPreRangeLength,
+                          std::optional<int> AnnotationPostRangeLength) {
   if (Slot) R.set_slot(*Slot);
   R.set_begin(Begin);
   R.set_end(End);
@@ -84,9 +87,93 @@
         R.set_existing_annotation(Nullability::UNKNOWN);
         break;
     }
+
+    if (AnnotationPreRangeLength)
+      R.set_existing_annotation_pre_range_length(*AnnotationPreRangeLength);
+    if (AnnotationPostRangeLength)
+      R.set_existing_annotation_post_range_length(*AnnotationPostRangeLength);
   }
 }
 
+/// If the tokens immediately before `Begin` are an absl::NullabilityUnknown<
+/// annotation start, returns the start location of the absl token. Else,
+/// returns std::nullopt.
+static std::pair<std::optional<unsigned>, std::optional<unsigned>>
+getStartAndEndOffsetsOfImmediateAbslAnnotation(SourceLocation Begin,
+                                               SourceLocation End,
+                                               const SourceManager &SM,
+                                               const LangOptions &LangOpts,
+                                               const FileID &DeclFID) {
+  // absl::NullabilityUnknown< is 4 tokens, one for the `<`, one for the `::`,
+  // and one for each identifier.
+  Token PrevTok = utils::lexer::getPreviousToken(Begin, SM, LangOpts);
+  if (!PrevTok.is(tok::TokenKind::less)) return {};
+  if (PrevTok =
+          utils::lexer::getPreviousToken(PrevTok.getLocation(), SM, LangOpts);
+      !PrevTok.is(tok::TokenKind::raw_identifier))
+    return {};
+  if (PrevTok.getRawIdentifier() != "NullabilityUnknown") return {};
+  if (PrevTok =
+          utils::lexer::getPreviousToken(PrevTok.getLocation(), SM, LangOpts);
+      PrevTok.isNot(tok::TokenKind::coloncolon))
+    return {};
+  if (PrevTok =
+          utils::lexer::getPreviousToken(PrevTok.getLocation(), SM, LangOpts);
+      !PrevTok.is(tok::TokenKind::raw_identifier))
+    return {};
+  if (PrevTok.getRawIdentifier() != "absl") return {};
+
+  auto [PrevTokFID, PrevTokOffset] = SM.getDecomposedLoc(PrevTok.getLocation());
+  if (PrevTokFID != DeclFID) return {};
+
+  Token NextTok;
+  // If the token immediately at `End` is a `>`, use the end location of that
+  // token. Otherwise, look for the next non-comment token, which should be a
+  // `>`.
+  if (bool Failed = Lexer::getRawToken(End, NextTok, SM, LangOpts,
+                                       /*IgnoreWhiteSpace=*/true))
+    return {};
+  if (!NextTok.is(tok::TokenKind::greater) &&
+      !NextTok.is(tok::TokenKind::greatergreater)) {
+    std::optional<Token> MaybeNextTok =
+        utils::lexer::findNextTokenSkippingComments(End, SM, LangOpts);
+    if (!MaybeNextTok || (!MaybeNextTok->is(tok::TokenKind::greater) &&
+                          !MaybeNextTok->is(tok::TokenKind::greatergreater)))
+      return {};
+    NextTok = *MaybeNextTok;
+  }
+
+  auto [NextTokFID, NextTokOffset] = SM.getDecomposedLoc(NextTok.getEndLoc());
+  if (NextTokFID != DeclFID) return {};
+  if (NextTok.is(tok::TokenKind::greatergreater)) {
+    // We need to step back one character.
+    --NextTokOffset;
+  }
+
+  return {PrevTokOffset, NextTokOffset};
+}
+
+/// If the token immediately after `End` is a clang _Null_unspecified attribute,
+/// returns the end location of the attribute. Else, returns std::nullopt.
+static std::optional<unsigned> getEndOffsetOfImmediateClangAttribute(
+    SourceLocation End, const SourceManager &SM, const LangOptions &LangOpts,
+    const FileID &DeclFID) {
+  // We can simply use `findNextTokenSkippingComments` because the attribute
+  // must come at least one space or comment after the type, so it will come
+  // after `End`, not at `End`.
+  std::optional<Token> NextTok =
+      utils::lexer::findNextTokenSkippingComments(End, SM, LangOpts);
+  if (!NextTok) return std::nullopt;
+  if (!NextTok->is(tok::TokenKind::raw_identifier) ||
+      NextTok->getRawIdentifier() != "_Null_unspecified")
+    return std::nullopt;
+
+  auto [FID, Offset] = SM.getDecomposedLoc(NextTok->getEndLoc());
+  if (FID != DeclFID) return std::nullopt;
+
+  return Offset;
+}
+
 // Extracts the source ranges and associated slot values of each eligible type
 // within `Loc`, accounting for (nested) qualifiers. Guarantees that each source
 // range is eligible for editing, including that its begin and end locations are
@@ -137,9 +224,33 @@
     auto [FID, BeginOffset] = SM.getDecomposedLoc(Begin);
     // If the type comes from a different file, then don't attempt to edit -- it
     // might need manual intervention.
-    if (FID == DeclFID)
-      initSlotRange(*Result.add_range(), SlotInContext, BeginOffset,
-                    SM.getFileOffset(R->getEnd()), Nullability);
+    if (FID != DeclFID) continue;
+
+    unsigned int EndOffset = SM.getFileOffset(R->getEnd());
+
+    // If the type is immediately wrapped in an absl nullability annotation or
+    // immediately followed by a clang nullability attribute, collect the
+    // pre- and post-range lengths for that annotation/attribute.
+    std::optional<int> AnnotationPreRangeLength;
+    std::optional<int> AnnotationPostRangeLength;
+    if (Nullability && *Nullability == NullabilityKind::Unspecified) {
+      auto [AnnotationStartOffset, AnnotationEndOffset] =
+          getStartAndEndOffsetsOfImmediateAbslAnnotation(Begin, R->getEnd(), SM,
+                                                         LangOpts, DeclFID);
+      if (AnnotationStartOffset && AnnotationEndOffset) {
+        AnnotationPreRangeLength = BeginOffset - *AnnotationStartOffset;
+        AnnotationPostRangeLength = *AnnotationEndOffset - EndOffset;
+      } else if (std::optional<unsigned> AttributeEndOffset =
+                     getEndOffsetOfImmediateClangAttribute(R->getEnd(), SM,
+                                                           LangOpts, DeclFID)) {
+        AnnotationPreRangeLength = 0;
+        AnnotationPostRangeLength = *AttributeEndOffset - EndOffset;
+      }
+    }
+
+    initSlotRange(*Result.add_range(), SlotInContext, BeginOffset, EndOffset,
+                  Nullability, AnnotationPreRangeLength,
+                  AnnotationPostRangeLength);
   }
 }
 
diff --git a/nullability/inference/eligible_ranges_test.cc b/nullability/inference/eligible_ranges_test.cc
index 8b4c5c2..e12355f 100644
--- a/nullability/inference/eligible_ranges_test.cc
+++ b/nullability/inference/eligible_ranges_test.cc
@@ -31,6 +31,7 @@
 using ::clang::ast_matchers::selectFirst;
 using ::clang::ast_matchers::varDecl;
 using ::llvm::Annotations;
+using ::testing::AllOf;
 using ::testing::ExplainMatchResult;
 using ::testing::Optional;
 using ::testing::UnorderedElementsAre;
@@ -805,5 +806,132 @@
               SlotRange(2, Input.range("param_two"), Nullability::NONNULL)))));
 }
 
+MATCHER(NoPreRangeLength, "") {
+  return !arg.has_existing_annotation_pre_range_length();
+}
+
+MATCHER(NoPostRangeLength, "") {
+  return !arg.has_existing_annotation_post_range_length();
+}
+
+MATCHER_P(PreRangeLength, Length, "") {
+  return arg.has_existing_annotation_pre_range_length() &&
+         arg.existing_annotation_pre_range_length() == Length;
+}
+
+MATCHER_P(PostRangeLength, Length, "") {
+  return arg.has_existing_annotation_post_range_length() &&
+         arg.existing_annotation_post_range_length() == Length;
+}
+
+TEST(ExistingAnnotationLengthTest, AbslTemplate) {
+  auto Input = Annotations(R"(
+  namespace absl {
+  template <typename T>
+  using NullabilityUnknown = ::NullabilityUnknown<T>;
+  }
+  void target($no[[int*]] p, absl::NullabilityUnknown<$yes[[int*]]> q,
+  absl::/* a comment*/NullabilityUnknown< /* a comment */ $with_comments[[int*]]
+  /* a comment */  > r);
+    )");
+  EXPECT_THAT(
+      getFunctionRanges(Input.code()),
+      Optional(TypeLocRanges(
+          MainFileName, UnorderedElementsAre(
+                            AllOf(SlotRange(1, Input.range("no")),
+                                  NoPreRangeLength(), NoPostRangeLength()),
+                            AllOf(SlotRange(2, Input.range("yes")),
+                                  PreRangeLength(25), PostRangeLength(1)),
+                            AllOf(SlotRange(3, Input.range("with_comments")),
+                                  PreRangeLength(56), PostRangeLength(21))))));
+}
+
+TEST(ExistingAnnotationLengthTest, AnnotationInMacro) {
+  auto Input = Annotations(R"(
+  namespace absl {
+  template <typename T>
+  using NullabilityUnknown = ::NullabilityUnknown<T>;
+  }
+
+  #define UNKNOWN(T) absl::NullabilityUnknown<T>
+
+  void target(UNKNOWN([[int *]]) x);
+  )");
+  EXPECT_THAT(
+      getFunctionRanges(Input.code()),
+      Optional(TypeLocRanges(
+          MainFileName, UnorderedElementsAre(AllOf(
+                            SlotRange(1, Input.range("")),
+                            // The token checks looking for annotations are done
+                            // without expansion of macros, so we see a left
+                            // paren as the preceding token and report no
+                            // existing pre-range/post-range annotation.
+                            NoPreRangeLength(), NoPostRangeLength())))));
+}
+
+TEST(ExistingAnnotationLengthTest, UniquePtr) {
+  auto Input = Annotations(R"(
+  namespace std {
+  template <typename T>
+  class unique_ptr;
+  }
+  namespace absl {
+  template <typename T>
+  using NullabilityUnknown = ::NullabilityUnknown<T>;
+  }
+  
+  void target(absl::NullabilityUnknown<[[std::unique_ptr<int>]]> x);
+  )");
+  EXPECT_THAT(getFunctionRanges(Input.code()),
+              Optional(TypeLocRanges(
+                  MainFileName, UnorderedElementsAre(AllOf(
+                                    SlotRange(1, Input.range("")),
+                                    PreRangeLength(25), PostRangeLength(1))))));
+}
+
+TEST(ExistingAnnotationLengthTest, DoubleClosingAngleBrackets) {
+  auto Input = Annotations(R"(
+  namespace absl {
+  template <typename T>
+  using NullabilityUnknown = ::NullabilityUnknown<T>;
+  }
+  
+  template <typename T>
+  using MyTemplateAlias = T;
+  
+  void target(MyTemplateAlias<absl::NullabilityUnknown<$nothing[[int *]]>> x,
+  MyTemplateAlias<absl::NullabilityUnknown<$comment[[int *]]>/* a comment */> y,
+  MyTemplateAlias<absl::NullabilityUnknown<$whitespace[[int *]]>
+  > z);
+  )");
+  EXPECT_THAT(
+      getFunctionRanges(Input.code()),
+      Optional(TypeLocRanges(
+          MainFileName, UnorderedElementsAre(
+                            AllOf(SlotRange(1, Input.range("nothing")),
+                                  PreRangeLength(25), PostRangeLength(1)),
+                            AllOf(SlotRange(2, Input.range("comment")),
+                                  PreRangeLength(25), PostRangeLength(1)),
+                            AllOf(SlotRange(3, Input.range("whitespace")),
+                                  PreRangeLength(25), PostRangeLength(1))))));
+}
+
+TEST(ExistingAnnotationLengthTest, ClangAttribute) {
+  auto Input = Annotations(R"(
+  void target($no[[int*]] p, $yes[[int*]] _Null_unspecified q,
+  $with_comment[[int*]]/* a comment */_Null_unspecified r);
+    )");
+  EXPECT_THAT(
+      getFunctionRanges(Input.code()),
+      Optional(TypeLocRanges(
+          MainFileName, UnorderedElementsAre(
+                            AllOf(SlotRange(1, Input.range("no")),
+                                  NoPreRangeLength(), NoPostRangeLength()),
+                            AllOf(SlotRange(2, Input.range("yes")),
+                                  PreRangeLength(0), PostRangeLength(18)),
+                            AllOf(SlotRange(3, Input.range("with_comment")),
+                                  PreRangeLength(0), PostRangeLength(32))))));
+}
+
 }  // namespace
 }  // namespace clang::tidy::nullability
diff --git a/nullability/inference/inference.proto b/nullability/inference/inference.proto
index eb280cf..a2c822a 100644
--- a/nullability/inference/inference.proto
+++ b/nullability/inference/inference.proto
@@ -151,6 +151,16 @@
   optional uint64 begin = 2;
   optional uint64 end = 3;
   optional Nullability existing_annotation = 4;
+  // The length of the source range before the slot that is part of an existing
+  // annotation to be potentially removed, e.g. the length of
+  // "absl::NullabilityUnknown<" or 0 if the existing annotation is a
+  // non-template representation, such as clang's "_Null_unspecified".
+  optional uint32 existing_annotation_pre_range_length = 5;
+  // The length of the source range after the slot that is part of an existing
+  // annotation to be potentially removed, e.g. 1 for ">" or longer for a
+  // non-template representation of annotations, such as clang's
+  // "_Null_unspecified".
+  optional uint32 existing_annotation_post_range_length = 6;
 }
 
 // A set of slot ranges and their associated file.
