g | x | w | all
Bytes Lang Time Link
038Retina180213T135014ZNeil
020J180213T152924ZGalen Iv
006Jelly180213T134054ZMr. Xcod
008Husk180213T143628ZMr. Xcod
007Pyth180213T134412ZMr. Xcod
163Java 8180213T143038ZKevin Cr
058Python 3180213T135020ZBijan
009Brachylog180213T134920ZFatalize
00805AB1E180213T134855ZMagic Oc

Retina, 42 38 bytes

Lv`(.)*.?(?<-1>\1)*(?(1)^)
.
.
O^`
\G.

Try it online! Link includes test cases. Edit: Saved 1 4 bytes thanks to @UnrelatedString. Explanation:

Lv`(.)*.?(?<-1>\1)*(?(1)^)

For each character in the string, find the longest palindrome that starts at that point.

.
.

Change all of the characters in the palindromes to the same character, so that sorting them lexically actually sorts by length.

O^`

Sort the found palindromes in reverse order of length.

\G.

Count the length of the first (i.e. longest) palindrome.

J, 20 bytes

[:>./@,#\(#*]-:|.)\]

Try it online!

Jelly, 6 bytes

Saved 1 byte thanks to Dennis (pointing out that Þ is stable and thus works instead of Ðf).

ẆŒḂÞṪL

Try it online!

How?

ẆŒḂÞṪL – Full program.

Ẇ      – All contiguous non-empty subsequences.
   Þ   – Stable sort by...
 ŒḂ    – 1 if the element is palindrome, 0 otherwise.
    Ṫ  – Get the last element.
     L – And take its length.

Note that the substrings are ordered by length, in Jelly.

Husk, 8 bytes

L►LfS=↔Q

Try it online!

How?

L►LfS=↔Q – Full program.

       Q – All contiguous non-empty subsequences.
   f     – Keep those...
    S=   – That are equal to themselves when...
      ↔  – Reversed.
 ►L      – Get the maximum element, sorted by length.
L        – Take its length.

Alternative: ▲mLfS=↔Q. Note that the substrings are not ordered by length, in Husk.

Pyth, 7 bytes

le_I#.:

Try it online!

How?

le_I#.: – Full program.

     .: – All contiguous non-empty subsequences.
    #   – Keep those...
  _I    – That are invariant under reversal.
 e      – Get the last element.
l       – And take its length.

Note that the substrings are ordered by length, in Pyth.

Java 8, 163 bytes

s->{int r=0,l=s.length(),i=0,j,T;for(String t;i<l;i++)for(j=i;++j<=l;r=t.contains(new StringBuffer(t).reverse())&(T=t.length())>r?T:r)t=s.substring(i,j);return r;}

Explanation:

Try it online.

s->{                 // Method with String parameter and integer return-type
  int r=0,           //  Result-String, starting empty
      l=s.length(),  //  The length of the input-String
      i=0,j,         //  Index-integers
      T;             //  Temp integer
  for(String t;      //  Temp String
      i<l;i++)       //  Loop `i` over the String
    for(j=i;++j<=l;  //   Inner loop `j` over the String
        r=           //     After every iteration, set the result to:
          t.contains(new StringBuffer(t).reverse())
                     //      If the temp-String is a palindrome,
          &(T=t.length())>r?
                     //      and the length of the substring is larger than the result
           T         //       Set this length as the new result
          :          //      Else:
           r)        //       Keep the result the same
      t=s.substring(i,j);
                     //    Set the temp String to the substring from index `i` to `j`
  return r;}         //  Return the result

Python 3, 58 bytes

f=lambda s:len(s)if s==s[::-1]else max(f(s[1:]),f(s[:-1]))

Try it online!

Brachylog, 9 bytes

{s.↔}ᶠlᵐ⌉

Try it online!

Explanation

{   }ᶠ       Find all…
 s.            …substrings of the input…
  .↔           …which are their own reverse
      lᵐ     Map length
        ⌉    Max

05AB1E, 9 8 bytes

ŒʒÂQ}€gM

Try it online!